faac-1.28/0000755010307701030770000000000011144236255014047 5ustar fabian-guestfabian-guestfaac-1.28/common/0000755010307701030770000000000011144236254015336 5ustar fabian-guestfabian-guestfaac-1.28/common/Cfaac/0000755010307701030770000000000011144236234016331 5ustar fabian-guestfabian-guestfaac-1.28/common/Cfaac/AudioCoding.bmp0000644010307701030770000011565610141510621021223 0ustar fabian-guestfabian-guestBM6( 2|mymvmtmsmsmsmsmtmtmtmtmsmumumvmxmzmzmzmzmymzm|m~mm~mzmxmvmvmwm{m}m~m~m{mzmzmzm|m|m~m~m~m~mm~mmm~mmmmm~m{mymxmvmvmvmvmvmvmwmwmxmymym{m{m|m~mmmmm|mymxmwmxmxmymymymymzmzm|m|m}m~mmmmmmm|mzmymxmxmwmwmvmvmumumumwmzm|m~m|mzmzm{m}m~m}m{mzm{m{m}m~mmmmmmmmmm~m}m|m|m}mmmm|mzmxmwmwmwmwmxmzm|m~mmmmmmmmmmmmmmmm~m}mzmymxmxmxmymzmymvmtmumumvmvmwmxmymzm|m~mmmmmmmmmmmmmmm}mzmxmwmvmvmvmumumumsmsmvmxm{mmmmmmm~m}mymxmwmwmwmxmymymzm{m~mmmm|mzmymzmzm{mzm{m{m{m{m{m{m|m_bekrrronkhifbc``]\\\ZZWWW\bhhhe_]YY\]\ZYYWWVTTSSSTS~S}SzVz]behkkkkkknnnkkknli`}\{X}Y\_b`]\YYZZWWUUTTS}S}SzSzV}\biihihihhhkkeb\\\]ZVUTUWZYYYYYYY\Y}Y}V}VVYY\\\YV}V\bhkhif_\YVV}WzVzVzVzZxYxYxYxXzVzVzYz\}\_bbeffeb__bihhecb`]]YYVV}SzSwQxQwSwQwSzR}S~TS~WZ]]`acehknqqke\VS}SzS}V}Y}\`ehknnnnooni_}Y}VYY]_\\ZYWWWWWU$1?OYYXQKFB?62.,! ,>EE<."   |{xvzx y&6>FGFGFGNOOJFGGB3 tqy'-,$ zzqr y(2:7:=:6>?FF=-#  } }  %7?=:2( }u q q qijiin q qxz$+-/2360%#,:>=6.+% sja_baijrw{}#(/7?HSVN9# sqs zy'5>FNOOHKKH:$zz $ 4DQ\\\WSSKLC@=4, ,?LSPB1(zyy{zys q rz { 6CLOKQOSSRRTKJD:*vrr~ -9<<4,'! y yv r y#+37:<;>CJKL@4,$%" $&&#$ &+,+%#0;<;3.%{ rrrnllpsrwz #,,//267<3%+;KH=<4,& rc ^ \ b g k jjmsy  %*4=JRZZD, r s r{%3;DLRRSSKB?/#zy )--%$)zo*s+y"0<=B8+'>HHHI@@<<6*ru0DWXQE<4+# z r qrrz "*37;:72+0475.+,$#+,+  %,38>>>99870'!! zvsrroprq8yp~|~q|m{j}v{t{v{w~~zg<"!/?IHC=4/$w$t&s,{-$~ne a g j j r zz%7ITUJ3 qjj js09HIHJ?3( &+)(,/0/+$YXURNJINIB<81ys v z #!.@PW^\B2&&*-&zk)s#07EJJNI<1& 6MQQPJJ;:2#v}*BTcc\M8/,# zzrppt{{ $/3:8,/1;BBC:0& #+(*% !)8;?CIBBBIFGFB8$**'&! {{wtttllkn|s}f|\~PE(2~~~|{xs'*CPQPKC3*vp"s4z<4,"xnhk ns{ {}zz4FPUSD' |jcjly1>IQPQC64*''*1,2;;<0~~~22~2+&"TSMJEBC;d~{{f}b{c|`~`}b~{zUt|x~}z||rkJÄy~z~kr}| 1=:2I|wz}sv~~|z{w~I#P|~xx|yu~f|f}v~y}z~t~tt3 +N}|w~z}eh~}|z{w~B$0Wƒ}y~z~_h~|MKK)#rkc*mr}yv~u}t~~#~{}{|{|{|{|{;+#Eŀ}w{~e`}{~y~|uR | {1y}w~z~}ok}zw}1u jr8+535-,$ RLJGBB<43j|~y{yx|x~~|c ~}~TFrq~~~QV 5@:4~~~We~~~$T}x~~~M~"}xyzIzy~}ri^I(}~~~&<~~|!-9~~~-:SQJ,}~yqju|~~~~'" :N[[TN:+~}~?65)}z|z w|~}~?9~}} jr. 8/;2+# KKCBC;:3+.q~~s4'i~~}n|~~J5~~~~~~rs{~~[Y99:8s~{~~~~Qb}{t}}}yuz{} "t~{~~~+@~~~~~{t*7;|~~~@KTTJ~~~~~+#~~~~~.y~~~~}|zyr~~~~~~~~~~&@PPG<4+v{~~~OEPJ=,{'z&yy s ro}{~~~~>2~~~~{r jr~~J5~~~~~OE~}:4+#KFBA>;3.+#)x}^U}u~ z}y|y|y|z|y}yC*z~y}y}y}y~ys#zB~|w|y{y{y{{$>|x|x|x|x}x}x?:9=q~{wyzw{|y{yzw|ys9 }v~~1}{{z{ { }"8q~z}w~y~yxy|y|y{w}zp3+:6G~~w~y}z|yw{SNK|x|x|x}x|x|x+#~y~y~yyy~uyyyzywc|zyJz€|xyyyptxyzy~y~y%CRSC:2')}l|y~w}y|zzuxozo}p~q|~Dws q rtk}{|w}y}zxuyywzj|p kr~y~y~y}y~y~t~y~z~y}y}y{w}}{t~w|y|y{y{yzwp;3+#RDC;853*%}5z}~~}}~~%v~|mrtuut4"moqoml}$s$z ;^szzyt~~~~}}*Cuz~~}vD<80/FK:03C]fefYF9.#)>]RJB:0+"r!s'z8FVWWA- oi lor#+5<7.)>C9*#&>G6}&"4Ree`XF=-"3Jg~aF23*#{{)>LVYL:# z rk*oMj^I,%4A=4%u j c9vtrR0'3C6+*.1*"9JVZVQLF?6/772,( $ yrrjdcc]` ftz"9UxyP5)#~2EOJ:3"zry"3NafZN>1# jbjrz~ v z#2B`i_B-+9CJN;*+BWdeeYK;0$"2NbVNJ?5+#~r&s*z3#*BvuN3*$r0BKIA1!zr'uQwM-$0-&rt(6??2${sDwY9(*2BKJB1%y$uJb;(*3)+BC8)"+"z8Tee_WJB:0)" $*1-) zvnlc b a a bk"s:ah*""2?B<8-(&|1YcdYB*hcchl rzw|"**+(!||;l`FBQYZS=+*;KZ_ZJ:+#;^QROGB;+~6}KONKRQI:* r kffj r|"%.=-".<;::;J[[WON>:AP[^ZJA4*#?v^<+sr!288,"zw'yWnG."*2CGD;5.~=mzO0"*2**BI:*#'#z|.Ndef[J<4+#+362& {  ~&z)w,rjgd bbk#s:\t*"#,:;9:3.*#z2UbcZB+x`^cc j rz&&zrsv#*'! z{7swQCSZZRC1+3DSZZM;**HmKNJA?6*"C7"*58:9;IQRNTkY@:ERYVJB:,":vU5#yr-23)zq3zgwV6!#*2>BABLLaf>$#*2.#BJC.")*$zx})E^eeaO=3+$)2;:/' z v $/~6|8{/tljddks:}Zu+#"&68:993/"v4R[^YB&n]]cbls(~0,$zrqrz"#! {z2~gbKO[ZSI7*2=KVYL9#3SyJJE;50$"CioiWRJC0"ul jrr t rt}';CB:"%225:=BKEDYX@>IQOKB;+:sR/r{*00#{#u@twe?$"*29BH`ssM+"*22"BLJ4'+**{wz9TdefTE9,# #3::6+ zm t"*8@G;|/t#plkk"s:[e& # 0689:21#zq9RYYWC" j]] bgr(z7;2+!zrmr$z$" y { uv1zg{VQUZZL9,09EMQE3#%;\JEB50*!(LuydTMA*#}m h j s xztz,BFB:""-327:BDBDgvOB@HJIB8+:sM"uw%**"zt-zSpgM*"-8@C[h3"-87*$BSM<-*-0)zt*CZceYK<1& | x 0:;2+ zj dt"%*;HRK8{,y(u$q"q's:ZR *34:42* z$uBRXYU<# j_ a bq2y4BRRC1*361!tw4O\_ZJ@6, z oz*483( zjcl$#%+*:K]XC9{1z4y4z4yC^pA !*24722*t6}MYXYR9 k b bi3yMSULD><3{-u({*0-! z orlk)tZ_RNROC2*1?BC7/'*+39BCB_{L:;;:72$!zAse-{#**"z*{BQP8{z+28Tc7~+28SfMFRUI5.3<6)~rz&?OZVJG;+# z jt$+1/#z jc-n<6--1>TedOB9~<~CEPmW/z"*2223,${-yR_ZXXK3{k ef$oJmmfZNJJF=~/z123*~ jkgk-savZMOJJ6*,6::.!#z6ZVB3#"@wwY>*yg \ ^cr/D^_OGB>1&"+*29BBMW<5/2.+!'zFxC)**""z2zAE9}%vr v06I{{I%|z06I{pLRYK;4:;;/rr}.AOPKF:+ skn*+)y jh?wWTE63CSmr_K>AJQ`tn>vz#'*31..)zMpp\WSJ1zlii/tc}hYVXYO;~20.+# rjcd2scgTIIF:*)-31)~"z?gbB2!.PbD*{c \`k(wGhzbPB9+!!%*19BFgbB1))%&{,zLg0,*""$z2z;}9}#ql kr$7Jp]3}rz$7JpSRYRB;;;;3 rkp%5EKIB;+ r e j!&# sh'kNssR@CWt}nVGHP]oS+yqz!)++*-**(#}7{sf[RJ1zrl kAxvgbfi_C4*))# r j ac1se\LDB9*#(-+!y'zGssH2 !;hrP/ucack=htTB4%"*1=BUkB, " x4zYB2*%%+|3z5z*ui b hr ,DiJ$urz",DicRVRH@:;80 xkk"|/;C@A5+ s b ez pe0m^}YQ^v}cSPXevB!qr z$*/255,***+#$yWsZRJ1#|rk,mMqpptjM:+ u j \c7spkTJB9+ "$%|{-zMzS2 )L|U2ufdf*rS^B2"#+5;KyvI*!s>~e\;1***,z+zm`a er)?jw9y!lr#z+?juRTRKI>42*zkk"t+47:72% p c b t { jf8skzijqZU_ln2u"kr%z3AMJA;3**+'z3|ydUJ2"r k5t_|{|x]@(t d\c=v}^JB:'zw5}Yb:5`_9{"lj"k7zmnE2 {z"*%rl)oOP2 } zz%.:MU.~}z6z[N:2442*vc \ ]h/^[+m!l&t>_\RRRKC7*"yl)s*s&}%&*%&ykc` j y ~ nc0lUrgiwV.o"o*wHpoR;1+&##"y>p`N:,+{6wOwqK,{}rc`.i[{VB2#z{yu*zKsM,zz$}9ezG/w)s8u^\7} z wz (4BnZ5zz'z@qX;8::2)rc ]bmOT1s's1zVgRRRRJ<*"w)w9|3w+z"!" rkbc j r { } ue c@wg|svU1t+u8|dvR;+%"""~0~VrW<33zB}^|T2zzre%eCxqbB1! yur s9~YR2z(z2PT8}3uH{tl< ytt{#|-;[`:{xz| |2zUZ@<==8*ueci4zvU2u0xBwhRRRRJ@*$*{:}H=~,z#r$k&ccg r t w pb,iN}zvU4x4zMR5("#$|*Dv~cH=BRq[8{z|zr"k8rXsH2 | rrr(xEjU8{3|Ki_D@~YwF#{rrw%z5Oc:{!szz|,zCt_CACC;+{li&qOW8}<~\nURRRQC1-|<LTH3z"zz!s+k-j'dk l r rk f~nZ=Juw[RRRSC9DW`bN:{&z{{)s1k3l.jkj olk-kRZAO}K*~"z"y*z6Ity[T_tb?{#swz$z5yI{hb:zr"s1yEjtYXngjJ)srr&w?abDz.s%t'z:~W~oQGJJ;/{/w7{R\HXzZRRRQJLiuvm]Cz+tz"v4s>v:s6o&kljl.o@xk`NcN+z#v&x3z@\lblbEz*s r"z/{C_uC'~{zt.vE`}shqwvI*s(s't5|TcI~7t0z9~TvxWJJKA@@JgfTny]RRROXq|eI1syz}z.tCxM}Gz@x0p's(p0tBx`kZsY7z*t/z;~PobE|3s+w0{EbM,zz z1zFZxsL:x9zA|RofRB}IWtz[LMJNVZ]yrczgRRSTvoR~4srzz}*z=}VWRH{Ax:t:yHbwiqB:}:|JfdOz*s$s&z8}Qj~qjdcm{kl{zcbmxUELb}z{oZUhvYS_cGz5t/y7}QsztytstYXj^Zee[\ubQA|FTqshqjY]|rZZqpXU`sf^leZe}jitun}mfvyywfaac-1.28/common/Cfaac/CRegistry.cpp0000644010307701030770000002410510141510625020745 0ustar fabian-guestfabian-guest/* CRegistry class Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include "CRegistry.h" //************************************************************************************************ CRegistry::CRegistry() { regKey=NULL; path=NULL; } //------------------------------------------------------------------------------------------------ CRegistry::~CRegistry() { Close(); } //************************************************************************************************ /* void CRegistry::ShowLastError(char *Caption) { LPVOID MsgBuf; if(FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &MsgBuf, 0, NULL )) MessageBox(NULL, (LPCTSTR)MsgBuf, Caption, MB_OK|MB_ICONSTOP); if(MsgBuf) LocalFree(MsgBuf); }*/ //************************************************************************************************ #define setPath(SubKey) \ { \ if(path) \ free(path); \ path=strdup(SubKey); \ } BOOL CRegistry::Open(HKEY hKey, char *SubKey) { if(regKey) RegCloseKey(regKey); if(RegOpenKeyEx(hKey, SubKey, 0, KEY_ALL_ACCESS, ®Key)==ERROR_SUCCESS) { setPath(SubKey); return TRUE; } else // can't open the key -> error { regKey=0; setPath(""); return FALSE; } } //************************************************************************************************ BOOL CRegistry::OpenCreate(HKEY hKey, char *SubKey) { if(regKey) RegCloseKey(regKey); if(RegOpenKeyEx(hKey, SubKey, 0, KEY_ALL_ACCESS, ®Key)==ERROR_SUCCESS) { setPath(SubKey); return TRUE; } else // open failed -> create the key { DWORD disp; RegCreateKeyEx(hKey, SubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, ®Key, &disp); if(disp==REG_CREATED_NEW_KEY) { setPath(SubKey); return TRUE; } else // can't create the key -> error { regKey=0; setPath(""); return FALSE; } } } //************************************************************************************************ void CRegistry::Close() { if(regKey) RegCloseKey(regKey); regKey=NULL; if(path) free(path); path=NULL; } //************************************************************************************************ //************************************************************************************************ //************************************************************************************************ void CRegistry::DeleteVal(char *SubKey) { RegDeleteValue(regKey,SubKey); } //************************************************************************************************ void CRegistry::DeleteKey(char *SubKey) { RegDeleteKey(regKey,SubKey); } //************************************************************************************************ //************************************************************************************************ //************************************************************************************************ void CRegistry::SetBool(char *keyStr, bool val) { bool tempVal; DWORD len=sizeof(bool); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS || tempVal!=val) RegSetValueEx(regKey, keyStr, 0, REG_BINARY, (BYTE *)&val, sizeof(bool)); } //************************************************************************************************ void CRegistry::SetByte(char *keyStr, BYTE val) { DWORD t=val; DWORD tempVal; DWORD len; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS || tempVal!=val) RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&t, sizeof(DWORD)); } //************************************************************************************************ void CRegistry::SetWord(char *keyStr, WORD val) { DWORD t=val; DWORD tempVal; DWORD len; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS || tempVal!=val) RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&t, sizeof(DWORD)); } //************************************************************************************************ void CRegistry::SetDword(char *keyStr, DWORD val) { DWORD tempVal; DWORD len; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS || tempVal!=val) RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&val, sizeof(DWORD)); } //************************************************************************************************ void CRegistry::SetFloat(char *keyStr, float val) { float tempVal; DWORD len; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS || tempVal!=val) RegSetValueEx(regKey, keyStr, 0, REG_BINARY, (BYTE *)&val, sizeof(float)); } //************************************************************************************************ void CRegistry::SetStr(char *keyStr, char *valStr) { DWORD len; DWORD slen=strlen(valStr)+1; if(!valStr || !*valStr) return; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, NULL, &len )!=ERROR_SUCCESS || len!=slen) RegSetValueEx(regKey, keyStr, 0, REG_SZ, (BYTE *)valStr, slen); else { char *tempVal=new char[slen]; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)tempVal, &len )!=ERROR_SUCCESS || strcmpi(tempVal,valStr)) RegSetValueEx(regKey, keyStr, 0, REG_SZ, (BYTE *)valStr, slen); delete tempVal; } } //************************************************************************************************ void CRegistry::SetValN(char *keyStr, BYTE *addr, DWORD size) { DWORD len; if(!addr || !size) return; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, NULL, &len )!=ERROR_SUCCESS || len!=size) RegSetValueEx(regKey, keyStr, 0, REG_BINARY, addr, size); else { BYTE *tempVal=new BYTE[size]; if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)tempVal, &len )!=ERROR_SUCCESS || memcmp(tempVal,addr,len)) RegSetValueEx(regKey, keyStr, 0, REG_BINARY, addr, size); delete tempVal; } } //************************************************************************************************ //************************************************************************************************ //************************************************************************************************ bool CRegistry::GetSetBool(char *keyStr, bool val) { bool tempVal; DWORD len=sizeof(bool); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS) { RegSetValueEx(regKey, keyStr, 0, REG_BINARY, (BYTE *)&val, sizeof(bool)); return val; } return tempVal; } //************************************************************************************************ BYTE CRegistry::GetSetByte(char *keyStr, BYTE val) { DWORD tempVal; DWORD len=sizeof(DWORD); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS) { tempVal=val; RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&tempVal, sizeof(DWORD)); return val; } return (BYTE)tempVal; } //************************************************************************************************ WORD CRegistry::GetSetWord(char *keyStr, WORD val) { DWORD tempVal; DWORD len=sizeof(DWORD); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS) { tempVal=val; RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&tempVal, sizeof(DWORD)); return val; } return (WORD)tempVal; } //************************************************************************************************ DWORD CRegistry::GetSetDword(char *keyStr, DWORD val) { DWORD tempVal; DWORD len=sizeof(DWORD); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS) { RegSetValueEx(regKey, keyStr, 0, REG_DWORD, (BYTE *)&val, sizeof(DWORD)); return val; } return (DWORD)tempVal; } //************************************************************************************************ float CRegistry::GetSetFloat(char *keyStr, float val) { float tempVal; DWORD len=sizeof(float); if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)&tempVal, &len )!=ERROR_SUCCESS) { RegSetValueEx(regKey, keyStr, 0, REG_BINARY, (BYTE *)&val, sizeof(float)); return val; } return tempVal; } //************************************************************************************************ char *CRegistry::GetSetStr(char *keyStr, char *String) { long retVal; DWORD Len; char *dest=NULL; if((retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, NULL, &Len))==ERROR_SUCCESS) if(dest=(char *)malloc(Len+1)) retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)dest , &Len); if(retVal!=ERROR_SUCCESS) { if(dest) free(dest); if(!String) return NULL; Len=strlen(String)+1; if(!(dest=strdup(String))) return NULL; RegSetValueEx(regKey , keyStr , NULL , REG_SZ , (BYTE *)dest , Len); } return dest; } // ----------------------------------------------------------------------------------------------- int CRegistry::GetSetValN(char *keyStr, BYTE *defData, DWORD defSize, BYTE **dest) { long retVal; DWORD size; dest=NULL; if((retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, NULL, &size))==ERROR_SUCCESS) if(*dest=(BYTE *)malloc(size+1)) retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)*dest , &size); if(retVal!=ERROR_SUCCESS) { if(dest) free(dest); if(!defData) return 0; size=defSize; if(!(*dest=(BYTE *)malloc(size))) return 0; memcpy(*dest,defData,size); RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)*dest , size); } return size; } faac-1.28/common/Cfaac/CRegistry.h0000644010307701030770000000354710141510625020421 0ustar fabian-guestfabian-guest/* CRegistry class Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ //--------------------------------------------------------------------------- #ifndef CRegistryH #define CRegistryH //--------------------------------------------------------------------------- #include #include #include //#include class CRegistry { public: CRegistry(); ~CRegistry(); BOOL Open(HKEY hKey, char *SubKey); BOOL OpenCreate(HKEY hKey, char *SubKey); void Close(); void DeleteVal(char *SubKey); void DeleteKey(char *SubKey); void SetBool(char *keyStr , bool val); void SetByte(char *keyStr , BYTE val); void SetWord(char *keyStr , WORD val); void SetDword(char *keyStr , DWORD val); void SetFloat(char *keyStr , float val); void SetStr(char *keyStr , char *valStr); void SetValN(char *keyStr , BYTE *addr, DWORD size); bool GetSetBool(char *keyStr, bool var); BYTE GetSetByte(char *keyStr, BYTE var); WORD GetSetWord(char *keyStr, WORD var); DWORD GetSetDword(char *keyStr, DWORD var); float GetSetFloat(char *keyStr, float var); char *GetSetStr(char *keyStr, char *String); int GetSetValN(char *keyStr, BYTE *defData, DWORD defSize, BYTE **dest); HKEY regKey; char *path; }; #endif faac-1.28/common/Cfaac/CTag.cpp0000644010307701030770000002375610141510625017663 0ustar fabian-guestfabian-guest/* CTag - Class to read/write id3v2/mp4 tags Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include #include #define HAVE_INT32_T #include #include "CTag.h" // ********************************************************************************************* // CMP4Tag // ********************************************************************************************* CMP4Tag::CMP4Tag() { // memset(this,0,sizeof(*this)); copyright=NULL; artist=title=album=year=genre=writer=comment=NULL; trackno=ntracks=discno=ndiscs=0; compilation=0; artFilename=NULL; art.pictureType=0; // = other memset(&art,0,sizeof(art)); } // ********************************************************************************************* void CMP4Tag::FreeTag() { FREE_ARRAY(artist); FREE_ARRAY(title); FREE_ARRAY(album); FREE_ARRAY(year); FREE_ARRAY(genre); FREE_ARRAY(writer); FREE_ARRAY(comment); FREE_ARRAY(artFilename); FREE_ARRAY(art.data); FREE_ARRAY(art.description); FREE_ARRAY(art.mimeType); FREE_ARRAY(art.format); } // *********************************************************************************************** int CMP4Tag::check_image_header(const char *buf) { if(!strncmp(buf, "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8)) return 1; /* PNG */ if(!strncmp(buf, "\xFF\xD8\xFF\xE0", 4) && !strncmp(buf + 6, "JFIF\0", 5)) return 2; /* JPEG */ if(!strncmp(buf, "GIF87a", 6) || !strncmp(buf, "GIF89a", 6)) return 3; /* GIF */ return 0; } // ----------------------------------------------------------------------------------------------- int CMP4Tag::ReadCoverArtFile(char *pCoverArtFile, char **artData) { FILE *artFile; if(!pCoverArtFile || !*pCoverArtFile) return 0; if(!(artFile=fopen(pCoverArtFile, "rb"))) { char buf[25+MAX_PATH+1]; sprintf(buf,"ReadCoverArtFile: can't open \"%s\"",pCoverArtFile); MessageBox(NULL,buf,NULL,MB_OK); return 0; } int r; char *art; int artSize=0; fseek(artFile, 0, SEEK_END); artSize=ftell(artFile); fseek(artFile, 0, SEEK_SET); if(!(art=(char *)malloc(artSize))) { fclose(artFile); MessageBox(NULL,"ReadCoverArtFile: Memory allocation error!", NULL, MB_OK); return 0; } r=fread(art, 1, artSize, artFile); if(r!=artSize) { free(art); fclose(artFile); MessageBox(NULL,"ReadCoverArtFile: Error reading cover art file!", NULL, MB_OK); return 0; } else if(artSize<12 || !check_image_header(art)) { // the above expression checks the image signature free(art); fclose(artFile); MessageBox(NULL,"ReadCoverArtFile: Unsupported cover image file format!", NULL, MB_OK); return 0; } FREE_ARRAY(*artData); *artData=art; fclose(artFile); return artSize; } // ********************************************************************************************* int CMP4Tag::WriteMP4Tag(MP4FileHandle MP4File) { char buf[512], *faac_id_string, *faac_copyright_string; if(MP4File==NULL) { MessageBox(NULL,"WriteMp4Tag: can't open file!",NULL,MB_OK); return 1; } sprintf(buf, "FAAC v%s", (faacEncGetVersion(&faac_id_string, &faac_copyright_string)==FAAC_CFG_VERSION) ? faac_id_string : " wrong libfaac version"); MP4SetMetadataTool(MP4File, buf); if(artist) MP4SetMetadataArtist(MP4File, artist); if(writer) MP4SetMetadataWriter(MP4File, writer); if(title) MP4SetMetadataName(MP4File, title); if(album) MP4SetMetadataAlbum(MP4File, album); if(trackno>0) MP4SetMetadataTrack(MP4File, trackno, ntracks); if(discno>0) MP4SetMetadataDisk(MP4File, discno, ndiscs); if(compilation) MP4SetMetadataCompilation(MP4File, compilation); if(year) MP4SetMetadataYear(MP4File, year); if(genre) MP4SetMetadataGenre(MP4File, genre); if(comment) MP4SetMetadataComment(MP4File, comment); if(art.size=ReadCoverArtFile(artFilename,&art.data)) { MP4SetMetadataCoverArt(MP4File, (unsigned __int8 *)art.data, art.size); FREE_ARRAY(art.data); } return 0; } // ********************************************************************************************* int CMP4Tag::ReadMp4Tag(char *Filename) { MP4FileHandle MP4File; if(!(MP4File=MP4Read(Filename, 0))) { char buf[25+MAX_PATH+1]; sprintf(buf,"ReadMp4Tag: can't open \"%s\"",Filename); MessageBox(NULL,buf,NULL,MB_OK); return 1; } FREE_ARRAY(copyright); MP4GetMetadataTool(MP4File, ©right); FREE_ARRAY(artist); MP4GetMetadataArtist(MP4File, &artist); FREE_ARRAY(writer); MP4GetMetadataWriter(MP4File, &writer); FREE_ARRAY(title); MP4GetMetadataName(MP4File, &title); FREE_ARRAY(album); MP4GetMetadataAlbum(MP4File, &album); MP4GetMetadataTrack(MP4File, (unsigned __int16 *)&trackno, (unsigned __int16 *)&ntracks); MP4GetMetadataDisk(MP4File, (unsigned __int16 *)&discno, (unsigned __int16 *)&ndiscs); MP4GetMetadataCompilation(MP4File, (unsigned __int8 *)&compilation); FREE_ARRAY(year); MP4GetMetadataYear(MP4File, &year); FREE_ARRAY(genre); MP4GetMetadataGenre(MP4File, &genre); FREE_ARRAY(comment); MP4GetMetadataComment(MP4File, &comment); FREE_ARRAY(art.data); MP4GetMetadataCoverArt(MP4File, (unsigned __int8 **)&art.data, (u_int32_t *)&art.size); MP4Close(MP4File); /* FILE *f=fopen("D:\\prova.jpg","wb"); fwrite(artFile,1,artSize,f); fclose(f);*/ return 0; } // ********************************************************************************************* #define DEL_FIELD(id3Tag,ID3FID) \ { \ ID3_Frame *Frame=id3Tag.Find(ID3FID); \ if(Frame!=NULL) \ id3Tag.RemoveFrame(Frame); \ } // ----------------------------------------------------------------------------------------------- #define ADD_FIELD(id3Tag,ID3FID,ID3FN,data) \ { \ ID3_Frame *NewFrame=new ID3_Frame(ID3FID); \ NewFrame->Field(ID3FN)=data; \ DEL_FIELD(id3Tag,ID3FID); \ id3Tag.AttachFrame(NewFrame); \ } // ----------------------------------------------------------------------------------------------- int CMP4Tag::WriteAacTag(char *Filename) { char buf[512], *faac_id_string, *faac_copyright_string; ID3_Tag id3Tag; FILE *file; if((file=fopen(Filename,"r"))==NULL) { char buf[25+MAX_PATH+1]; sprintf(buf,"WriteAacTag: can't open \"%s\"",Filename); MessageBox(NULL,buf,NULL,MB_OK); return 1; } else fclose(file); id3Tag.Link(Filename); sprintf(buf, "FAAC v%s", (faacEncGetVersion(&faac_id_string, &faac_copyright_string)==FAAC_CFG_VERSION) ? faac_id_string : " wrong libfaac version"); ADD_FIELD(id3Tag,ID3FID_ENCODEDBY,ID3FN_TEXT,buf); ADD_FIELD(id3Tag,ID3FID_LEADARTIST,ID3FN_TEXT,artist); ADD_FIELD(id3Tag,ID3FID_COMPOSER,ID3FN_TEXT,writer); ADD_FIELD(id3Tag,ID3FID_TITLE,ID3FN_TEXT,title); ADD_FIELD(id3Tag,ID3FID_ALBUM,ID3FN_TEXT,album); sprintf(buf,"%d",trackno); ADD_FIELD(id3Tag,ID3FID_TRACKNUM,ID3FN_TEXT,buf); ADD_FIELD(id3Tag,ID3FID_YEAR,ID3FN_TEXT,year); ADD_FIELD(id3Tag,ID3FID_CONTENTTYPE,ID3FN_TEXT,genre); ADD_FIELD(id3Tag,ID3FID_COMMENT,ID3FN_TEXT,comment); art.size=ReadCoverArtFile(artFilename,&art.data); if(art.size) { ID3_Frame *NewFrame=new ID3_Frame(ID3FID_PICTURE); char name[_MAX_FNAME], ext[_MAX_EXT]; _splitpath(artFilename,NULL,NULL,name,ext); NewFrame->Field(ID3FN_DESCRIPTION)=name; char buf[15]; sprintf(buf,"image/%s",check_image_header(art.data)==2 ? "jpeg" : strlwr(ext+1)); NewFrame->Field(ID3FN_MIMETYPE)=buf; // NewFrame->Field(ID3FN_IMAGEFORMAT)=; NewFrame->Field(ID3FN_PICTURETYPE)=(DWORD)art.pictureType; NewFrame->Field(ID3FN_DATA).Set((BYTE *)art.data,art.size); id3Tag.AttachFrame(NewFrame); } // setup all our rendering parameters id3Tag.SetUnsync(false); id3Tag.SetExtendedHeader(true); id3Tag.SetCompression(true); id3Tag.SetPadding(true); // write any changes to the file id3Tag.Update(); FREE_ARRAY(art.data); return 0; } // ********************************************************************************************* #define GET_FIELD_STR(id3Tag,ID3FID,ID3FN,data) \ { \ Frame=id3Tag.Find(ID3FID); \ if(Frame!=NULL) \ { \ DWORD size=Frame->Field(ID3FN).Size(); \ FREE_ARRAY(data); \ if(data=(char *)malloc(size+1)) \ Frame->Field(ID3FN).Get(data,size+1); \ } \ else \ FREE_ARRAY(data); \ } // ----------------------------------------------------------------------------------------------- int CMP4Tag::ReadAacTag(char *Filename) { char *buf=NULL; ID3_Tag id3Tag; ID3_Frame *Frame; if(!id3Tag.Link(Filename)) { char buf[25+MAX_PATH+1]; sprintf(buf,"ReadAacTag: can't open \"%s\"",Filename); MessageBox(NULL,buf,NULL,MB_OK); return 1; } GET_FIELD_STR(id3Tag,ID3FID_ENCODEDBY,ID3FN_TEXT,copyright); GET_FIELD_STR(id3Tag,ID3FID_LEADARTIST,ID3FN_TEXT,artist); GET_FIELD_STR(id3Tag,ID3FID_COMPOSER,ID3FN_TEXT,writer); GET_FIELD_STR(id3Tag,ID3FID_TITLE,ID3FN_TEXT,title); GET_FIELD_STR(id3Tag,ID3FID_ALBUM,ID3FN_TEXT,album); GET_FIELD_STR(id3Tag,ID3FID_TRACKNUM,ID3FN_TEXT,buf); if(buf) trackno=atoi(buf); FREE_ARRAY(buf); GET_FIELD_STR(id3Tag,ID3FID_YEAR,ID3FN_TEXT,year); GET_FIELD_STR(id3Tag,ID3FID_CONTENTTYPE,ID3FN_TEXT,genre); GET_FIELD_STR(id3Tag,ID3FID_COMMENT,ID3FN_TEXT,comment); if(Frame=id3Tag.Find(ID3FID_PICTURE)) { art.size=Frame->Field(ID3FN_DATA).Size(); FREE_ARRAY(art.data); if(art.data=(char *)malloc(art.size)) memcpy(art.data,Frame->Field(ID3FN_DATA).GetBinary(),art.size); GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_MIMETYPE,art.mimeType); GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_DESCRIPTION,art.description); GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_IMAGEFORMAT,art.format); art.pictureType=Frame->Field(ID3FN_PICTURETYPE).Get(); /* FILE *f=fopen("D:\\prova.jpg","wb"); fwrite(artFile,1,artSize,f); fclose(f);*/ } return 0; }faac-1.28/common/Cfaac/CTag.h0000644010307701030770000000466210141510625017323 0ustar fabian-guestfabian-guest/* CTag - Class to read/write id3v2/mp4 tags Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #ifndef _CTag_H #define _CTag_H // ********************************************************************************************* #include #include // id3 tag #include "CRegistry.h" #include "Defines.h" // ********************************************************************************************* #define REG_TAGON "Tag On" #define REG_TAGIMPORT "Tag import" #define REG_ARTIST "Tag Artist" #define REG_TITLE "Tag Title" #define REG_ALBUM "Tag Album" #define REG_YEAR "Tag Year" #define REG_GENRE "Tag Genre" #define REG_WRITER "Tag Writer" #define REG_COMMENT "Tag Comment" #define REG_TRACK "Tag Track" #define REG_NTRACKS "Tag Tracks" #define REG_DISK "Tag Disk" #define REG_NDISKS "Tag Disks" #define REG_COMPILATION "Tag Compilation" #define REG_ARTFILE "Tag Art file" // ********************************************************************************************* typedef struct { char *data; DWORD size; DWORD pictureType; // front, back, icon, ... char *mimeType, // jpg, png, gif *format, // ??? *description; // text description } id3Picture; class CMP4Tag { private: int check_image_header(const char *buf); int ReadCoverArtFile(char *pCoverArtFile, char **artBuf); public: CMP4Tag(); virtual ~CMP4Tag() { FreeTag(); } virtual void FreeTag(); virtual int WriteMP4Tag(MP4FileHandle MP4File); virtual int WriteAacTag(char *Filename); virtual int ReadMp4Tag(char *Filename); virtual int ReadAacTag(char *Filename); char *copyright; // used in Cfaad char *artist, *title, *album, *year, *genre, *writer, *comment; WORD trackno,ntracks, discno,ndiscs; BYTE compilation; char *artFilename; id3Picture art; // used in ReadAacTag(). Remark: field not stored into registry }; #endiffaac-1.28/common/Cfaac/Cfaac.cpp0000644010307701030770000004567110141510622020037 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include "Cfaac.h" // ********************************************************************************************* // CMyEncCfg // ********************************************************************************************* void CMyEncCfg::getCfg(CMyEncCfg *cfg) { CRegistry reg; if(reg.OpenCreate(HKEY_CURRENT_USER, REGISTRY_PROGRAM_NAME "\\FAAC")) { cfg->AutoCfg=reg.GetSetBool(REG_AUTO,DEF_AUTO); cfg->SaveMP4=reg.GetSetByte(REG_WRITEMP4,DEF_WRITEMP4); cfg->EncCfg.mpegVersion=reg.GetSetDword(REG_MPEGVER,DEF_MPEGVER); cfg->EncCfg.aacObjectType=reg.GetSetDword(REG_PROFILE,DEF_PROFILE); cfg->EncCfg.allowMidside=reg.GetSetDword(REG_MIDSIDE,DEF_MIDSIDE); cfg->EncCfg.useTns=reg.GetSetDword(REG_TNS,DEF_TNS); cfg->EncCfg.useLfe=reg.GetSetDword(REG_LFE,DEF_LFE); cfg->UseQuality=reg.GetSetBool(REG_USEQUALTY,DEF_USEQUALTY); cfg->EncCfg.quantqual=reg.GetSetDword(REG_QUALITY,DEF_QUALITY); cfg->EncCfg.bitRate=reg.GetSetDword(REG_BITRATE,DEF_BITRATE); cfg->EncCfg.bandWidth=reg.GetSetDword(REG_BANDWIDTH,DEF_BANDWIDTH); cfg->EncCfg.outputFormat=reg.GetSetDword(REG_HEADER,DEF_HEADER); FREE_ARRAY(cfg->OutDir); cfg->OutDir=reg.GetSetStr(REG_OutFolder,""); cfg->TagOn=reg.GetSetByte(REG_TAGON,0); #ifdef USE_IMPORT_TAG cfg->TagImport=reg.GetSetByte(REG_TAGIMPORT,0); #ifdef USE_PATHEXT FREE_ARRAY(cfg->TagSrcPath); FREE_ARRAY(cfg->TagSrcExt); cfg->TagSrcPath=reg.GetSetStr(REG_InFolder,""); cfg->TagSrcExt=reg.GetSetStr(REG_SrcExt,""); #endif #endif cfg->Tag.artist=reg.GetSetStr(REG_ARTIST,""); cfg->Tag.title=reg.GetSetStr(REG_TITLE,""); cfg->Tag.album=reg.GetSetStr(REG_ALBUM,""); cfg->Tag.year=reg.GetSetStr(REG_YEAR,""); cfg->Tag.genre=reg.GetSetStr(REG_GENRE,""); cfg->Tag.writer=reg.GetSetStr(REG_WRITER,""); cfg->Tag.comment=reg.GetSetStr(REG_COMMENT,""); cfg->Tag.trackno=reg.GetSetWord(REG_TRACK,0); cfg->Tag.ntracks=reg.GetSetWord(REG_NTRACKS,0); cfg->Tag.discno=reg.GetSetWord(REG_DISK,0); cfg->Tag.ndiscs=reg.GetSetWord(REG_NDISKS,0); cfg->Tag.compilation=reg.GetSetByte(REG_COMPILATION,0); cfg->Tag.artFilename=reg.GetSetStr(REG_ARTFILE,""); } else MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP); } // ----------------------------------------------------------------------------------------------- void CMyEncCfg::setCfg(CMyEncCfg *cfg) { CRegistry reg; if(reg.OpenCreate(HKEY_CURRENT_USER, REGISTRY_PROGRAM_NAME "\\FAAC")) { reg.SetBool(REG_AUTO,cfg->AutoCfg); reg.SetByte(REG_WRITEMP4,cfg->SaveMP4); reg.SetDword(REG_MPEGVER,cfg->EncCfg.mpegVersion); reg.SetDword(REG_PROFILE,cfg->EncCfg.aacObjectType); reg.SetDword(REG_MIDSIDE,cfg->EncCfg.allowMidside); reg.SetDword(REG_TNS,cfg->EncCfg.useTns); reg.SetDword(REG_LFE,cfg->EncCfg.useLfe); reg.SetBool(REG_USEQUALTY,cfg->UseQuality); reg.SetDword(REG_QUALITY,cfg->EncCfg.quantqual); reg.SetDword(REG_BITRATE,cfg->EncCfg.bitRate); reg.SetDword(REG_BANDWIDTH,cfg->EncCfg.bandWidth); reg.SetDword(REG_HEADER,cfg->EncCfg.outputFormat); reg.SetStr(REG_OutFolder,cfg->OutDir); reg.SetByte(REG_TAGON,cfg->TagOn); #ifdef USE_IMPORT_TAG reg.SetByte(REG_TAGIMPORT,cfg->TagImport); #ifdef USE_PATHEXT reg.SetStr(REG_InFolder,cfg->TagSrcPath); reg.SetStr(REG_SrcExt,cfg->TagSrcExt); #endif #endif reg.SetStr(REG_ARTIST,cfg->Tag.artist); reg.SetStr(REG_TITLE,cfg->Tag.title); reg.SetStr(REG_ALBUM,cfg->Tag.album); reg.SetStr(REG_YEAR,cfg->Tag.year); reg.SetStr(REG_GENRE,cfg->Tag.genre); reg.SetStr(REG_WRITER,cfg->Tag.writer); reg.SetStr(REG_COMMENT,cfg->Tag.comment); reg.SetWord(REG_TRACK,cfg->Tag.trackno); reg.SetWord(REG_NTRACKS,cfg->Tag.ntracks); reg.SetWord(REG_DISK,cfg->Tag.discno); reg.SetWord(REG_NDISKS,cfg->Tag.ndiscs); reg.SetByte(REG_COMPILATION,cfg->Tag.compilation); reg.SetStr(REG_ARTFILE,cfg->Tag.artFilename); } else MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP); } // ********************************************************************************************* // Cfaac // ********************************************************************************************* Cfaac::Cfaac(HANDLE hOut) { if(hOut) { hOutput=hOut; return; } if(!(hOutput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT,sizeof(MYOUTPUT)))) { MessageBox(0, "Memory allocation error: hOutput", APP_NAME " plugin", MB_OK|MB_ICONSTOP); \ return; } // dontAskGetFilename=false; } // ----------------------------------------------------------------------------------------------- Cfaac::~Cfaac() { if(!hOutput) return; MYOUTPUT *mo; GLOBALLOCK(mo,hOutput,MYOUTPUT,return); if(mo->WrittenSamples) { int BytesWritten; if(mo->bytes_into_buffer>0) memset(mo->bufIn+mo->bytes_into_buffer, 0, (mo->samplesInput*(mo->BitsPerSample>>3))-mo->bytes_into_buffer); do { if((BytesWritten=processData(hOutput,mo->bufIn,mo->bytes_into_buffer))<0) MessageBox(0, "~Cfaac: processData", APP_NAME " plugin", MB_OK|MB_ICONSTOP); mo->bytes_into_buffer=0; }while(BytesWritten>0); } if(mo->aacFile) { fclose(mo->aacFile); mo->aacFile=0; CMyEncCfg cfg(false); if(cfg.TagOn && mo->OutFilename) { int error=0; #ifdef USE_IMPORT_TAG if(cfg.TagImport && mo->InFilename) { int l=strlen(mo->InFilename); if( !strcmpi(mo->InFilename+l-4,".mp4") || !strcmpi(mo->InFilename+l-4,".m4a") || !strcmpi(mo->InFilename+l-4,".m4b")) error=cfg.Tag.ReadMp4Tag(mo->InFilename); else error=cfg.Tag.ReadAacTag(mo->InFilename); } #endif if(!error) cfg.Tag.WriteAacTag(mo->OutFilename); } } else { MP4Close(mo->MP4File); mo->MP4File=0; } if(mo->hEncoder) faacEncClose(mo->hEncoder); FREE_ARRAY(mo->bitbuf) FREE_ARRAY(mo->buf32bit) FREE_ARRAY(mo->bufIn) FREE_ARRAY(mo->OutFilename) FREE_ARRAY(mo->InFilename) GlobalUnlock(hOutput); GlobalFree(hOutput); } // ********************************************************************************************* // Utilities // ********************************************************************************************* char *Cfaac::getSourceFilename(char *path, char *src, char *ext) { char *dst, chExt, *pname, *pext; if(!src) return NULL; if(!path) path=""; if(!ext) ext=""; pname=pext=src+strlen(src); while(pname!=src && *pname!='\\' && *pname!='/') pname--; if(*pname=='\\' || *pname=='/') pname++; while(pext!=src && *pext!='.') pext--; chExt=*pext; if(chExt=='.') *pext='\0'; if(*path) { int l; if(!(dst=(char *)malloc(strlen(path)+strlen(pname)+strlen(ext)+3))) // '\0','\\','.' return dst; l=strlen(path); if(l>0 && path[l-1]=='\\') sprintf(dst,"%s%s.%s",path,pname,ext); else sprintf(dst,"%s\\%s.%s",path,pname,ext); } else { if(!(dst=(char *)malloc(strlen(pname)+strlen(ext)+2))) return dst; sprintf(dst,"%s.%s",pname,ext); } *pext=chExt; if(!strcmpi(src,dst)) { // if(!dontAskGetFilename) { char buf[MAX_PATH+100]; sprintf(buf,"%s\nSource file=Destination file...aborting!\n\n\tSuppress this warning?",dst); // if(MessageBox(NULL,buf,NULL,MB_YESNO)==IDYES) // dontAskGetFilename=true; } FREE_ARRAY(dst); return NULL; } return dst; } // ********************************************************************************************* #define SWAP32(x) (((x & 0xff) << 24) | ((x & 0xff00) << 8) \ | ((x & 0xff0000) >> 8) | ((x & 0xff000000) >> 24)) #define SWAP16(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8)) void Cfaac::To32bit(int32_t *buf, BYTE *bufi, int size, BYTE samplebytes, BYTE bigendian) { int i; switch(samplebytes) { case 1: // this is endian clean for (i = 0; i < size; i++) buf[i] = (bufi[i] - 128) * 65536; break; case 2: #ifdef WORDS_BIGENDIAN if (!bigendian) #else if (bigendian) #endif { // swap bytes for (i = 0; i < size; i++) { int16_t s = ((int16_t *)bufi)[i]; s = SWAP16(s); buf[i] = ((u_int32_t)s) << 8; } } else { // no swap for (i = 0; i < size; i++) { int s = ((int16_t *)bufi)[i]; buf[i] = s << 8; } } break; case 3: if (!bigendian) { for (i = 0; i < size; i++) { int s = bufi[3 * i] | (bufi[3 * i + 1] << 8) | (bufi[3 * i + 2] << 16); // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = s; } } else // big endian input { for (i = 0; i < size; i++) { int s = (bufi[3 * i] << 16) | (bufi[3 * i + 1] << 8) | bufi[3 * i + 2]; // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = s; } } break; case 4: #ifdef WORDS_BIGENDIAN if (!bigendian) #else if (bigendian) #endif { // swap bytes for (i = 0; i < size; i++) { int s = bufi[i]; buf[i] = SWAP32(s); } } else memcpy(buf,bufi,size*sizeof(u_int32_t)); /* int exponent, mantissa; float *bufo=(float *)buf; for (i = 0; i < size; i++) { exponent=bufi[(i<<2)+3]<<1; if(bufi[i*4+2] & 0x80) exponent|=0x01; exponent-=126; mantissa=(DWORD)bufi[(i<<2)+2]<<16; mantissa|=(DWORD)bufi[(i<<2)+1]<<8; mantissa|=bufi[(i<<2)]; bufo[i]=(float)ldexp(mantissa,exponent); }*/ break; } } // ********************************************************************************************* // Main functions // ********************************************************************************************* void Cfaac::DisplayError(char *ProcName, char *str) { char buf[100]=""; if(str && *str) { if(ProcName && *ProcName) sprintf(buf,"%s: ", ProcName); strcat(buf,str); MessageBox(0, buf, APP_NAME " plugin", MB_OK|MB_ICONSTOP); } MYOUTPUT *mo; GLOBALLOCK(mo,hOutput,MYOUTPUT,return); mo->bytes_into_buffer=-1; GlobalUnlock(hOutput); GlobalUnlock(hOutput); } // ********************************************************************************************* HANDLE Cfaac::Init(LPSTR InFileName, LPSTR OutFileName,long lSamprate,WORD wBitsPerSample,WORD wChannels,long FileSize) { MYOUTPUT *mo; CMyEncCfg cfg(false); DWORD samplesInput, maxBytesOutput; // if(wBitsPerSample!=8 && wBitsPerSample!=16) // 32 bit audio from cooledit is in unsupported format // return 0; if(wChannels>48) // FAAC supports max 48 tracks! return NULL; GLOBALLOCK(mo,hOutput,MYOUTPUT,return NULL); // open the encoder library if(!(mo->hEncoder=faacEncOpen(lSamprate, wChannels, &samplesInput, &maxBytesOutput))) return ERROR_Init("Can't open library"); if(!(mo->bitbuf=(unsigned char *)malloc(maxBytesOutput*sizeof(unsigned char)))) return ERROR_Init("Memory allocation error: output buffer"); if(!(mo->bufIn=(BYTE *)malloc(samplesInput*sizeof(int32_t)))) return ERROR_Init("Memory allocation error: input buffer"); if(!(mo->buf32bit=(int32_t *)malloc(samplesInput*sizeof(int32_t)))) return ERROR_Init("Memory allocation error: 32 bit buffer"); if(cfg.SaveMP4)// || cfg.Tag.On) { int ExtPos=0, // append new ext fnLen=lstrlen(OutFileName); // if(OutFileName[lstrlen(OutFileName)-4]=='.') if( fnLen>=4 && (!strcmpi(OutFileName+fnLen-4,".aac") || !strcmpi(OutFileName+fnLen-4,".mp4") || !strcmpi(OutFileName+fnLen-4,".m4a") || !strcmpi(OutFileName+fnLen-4,".m4b"))) // no aac/mp4 ext => append new ext if( (cfg.SaveMP4==1 && strcmpi(OutFileName+fnLen-4,".mp4")) || (cfg.SaveMP4==2 && strcmpi(OutFileName+fnLen-4,".m4a")) || (cfg.SaveMP4==3 && strcmpi(OutFileName+fnLen-4,".m4b"))) ExtPos=4; // wrong ext => replace it else ExtPos=-1; // correct ext => no action if(ExtPos!=-1) { switch(cfg.SaveMP4) { case 1: strcpy(OutFileName+fnLen-ExtPos,".mp4"); break; case 2: strcpy(OutFileName+fnLen-ExtPos,".m4a"); break; case 3: strcpy(OutFileName+fnLen-ExtPos,".m4b"); break; } FILE *f=fopen(OutFileName,"rb"); if(f) { char buf[MAX_PATH+20]; sprintf(buf,"Overwrite \"%s\" ?",OutFileName); fclose(f); if(MessageBox(NULL,buf,"File already exists!",MB_YESNO|MB_ICONQUESTION)==IDNO) return ERROR_Init(0);//"User abort"); } } } mo->WriteMP4= !strcmpi(OutFileName+lstrlen(OutFileName)-4,".mp4") || !strcmpi(OutFileName+lstrlen(OutFileName)-4,".m4a") || !strcmpi(OutFileName+lstrlen(OutFileName)-4,".m4b"); faacEncConfigurationPtr CurFormat=faacEncGetCurrentConfiguration(mo->hEncoder); CurFormat->inputFormat=FAAC_INPUT_32BIT; /* switch(wBitsPerSample) { case 16: CurFormat->inputFormat=FAAC_INPUT_16BIT; break; case 24: CurFormat->inputFormat=FAAC_INPUT_24BIT; break; case 32: CurFormat->inputFormat=FAAC_INPUT_32BIT; break; default: CurFormat->inputFormat=FAAC_INPUT_NULL; break; }*/ if(!cfg.AutoCfg) { faacEncConfigurationPtr myFormat=&cfg.EncCfg; if(cfg.UseQuality) { CurFormat->quantqual=myFormat->quantqual; CurFormat->bitRate=0;//myFormat->bitRate; } else { CurFormat->bitRate=(myFormat->bitRate*1000)/wChannels; CurFormat->quantqual=100; } switch(CurFormat->bandWidth) { case 0: // Auto break; case 0xffffffff: // Full CurFormat->bandWidth=lSamprate/2; break; default: CurFormat->bandWidth=myFormat->bandWidth; break; } CurFormat->mpegVersion=myFormat->mpegVersion; CurFormat->outputFormat=myFormat->outputFormat; CurFormat->mpegVersion=myFormat->mpegVersion; CurFormat->aacObjectType=myFormat->aacObjectType; CurFormat->allowMidside=myFormat->allowMidside; // CurFormat->useTns=myFormat->useTns; CurFormat->useTns=false; } else { CurFormat->mpegVersion=DEF_MPEGVER; CurFormat->aacObjectType=DEF_PROFILE; CurFormat->allowMidside=DEF_MIDSIDE; // CurFormat->useTns=DEF_TNS; CurFormat->useTns=false; CurFormat->useLfe=DEF_LFE; CurFormat->quantqual=DEF_QUALITY; CurFormat->bitRate=DEF_BITRATE; CurFormat->bandWidth=DEF_BANDWIDTH; CurFormat->outputFormat=DEF_HEADER; } if(mo->WriteMP4) CurFormat->outputFormat=RAW; CurFormat->useLfe=wChannels>=6 ? 1 : 0; if(!faacEncSetConfiguration(mo->hEncoder, CurFormat)) return ERROR_Init("Unsupported parameters!"); // mo->src_size=lSize; // mi->dst_name=strdup(OutFileName); mo->Samprate=lSamprate; mo->BitsPerSample=wBitsPerSample; mo->Channels=wChannels; mo->samplesInput=samplesInput; mo->samplesInputSize=samplesInput*(mo->BitsPerSample>>3); mo->maxBytesOutput=maxBytesOutput; if(mo->WriteMP4) // Create MP4 file -------------------------------------------------------------------------- { BYTE *ASC=0; DWORD ASCLength=0; if((mo->MP4File=MP4Create(OutFileName, 0, 0))==MP4_INVALID_FILE_HANDLE) return ERROR_Init("Can't create file"); MP4SetTimeScale(mo->MP4File, 90000); mo->MP4track=MP4AddAudioTrack(mo->MP4File, lSamprate, MP4_INVALID_DURATION, MP4_MPEG4_AUDIO_TYPE); MP4SetAudioProfileLevel(mo->MP4File, 0x0F); faacEncGetDecoderSpecificInfo(mo->hEncoder, &ASC, &ASCLength); MP4SetTrackESConfiguration(mo->MP4File, mo->MP4track, (unsigned __int8 *)ASC, ASCLength); mo->frameSize=samplesInput/wChannels; mo->ofs=mo->frameSize; if(cfg.TagOn) { int error=0; #ifdef USE_IMPORT_TAG if(cfg.TagImport && InFileName) { int l=strlen(InFileName); if( !strcmpi(InFileName+l-4,".mp4") || !strcmpi(InFileName+l-4,".m4a") || !strcmpi(InFileName+l-4,".m4b")) error=cfg.Tag.ReadMp4Tag(InFileName); else error=cfg.Tag.ReadAacTag(InFileName); } #endif if(!error) cfg.Tag.WriteMP4Tag(mo->MP4File); } } else // Create AAC file ----------------------------------------------------------------------------- { // open the aac output file if(!(mo->aacFile=fopen(OutFileName, "wb"))) return ERROR_Init("Can't create file"); // use bufferized stream setvbuf(mo->aacFile,NULL,_IOFBF,32767); mo->InFilename=strdup(InFileName); mo->OutFilename=strdup(OutFileName); } showInfo(mo); GlobalUnlock(hOutput); return hOutput; } // ********************************************************************************************* int Cfaac::processData(HANDLE hOutput, BYTE *bufIn, DWORD len) { if(!hOutput) return -1; int bytesWritten=0; int bytesEncoded; MYOUTPUT far *mo; GLOBALLOCK(mo,hOutput,MYOUTPUT,return 0); int32_t *buf=mo->buf32bit; if((int)lensamplesInputSize) { mo->samplesInput=(len<<3)/mo->BitsPerSample; mo->samplesInputSize=mo->samplesInput*(mo->BitsPerSample>>3); } // if(mo->BitsPerSample==8 || mo->BitsPerSample==32) To32bit(buf,bufIn,mo->samplesInput,mo->BitsPerSample>>3,false); // call the actual encoding routine if((bytesEncoded=faacEncEncode(mo->hEncoder, (int32_t *)buf, mo->samplesInput, mo->bitbuf, mo->maxBytesOutput))<0) return ERROR_processData("faacEncEncode()"); // write bitstream to aac file if(mo->aacFile) { if(bytesEncoded>0) { if((bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->aacFile))!=bytesEncoded) return ERROR_processData("Write failed!"); mo->WrittenSamples=1; // needed into destructor } } else // write bitstream to mp4 file { MP4Duration dur, SamplesLeft; if(len>0) { mo->srcSize+=len; dur=mo->frameSize; } else { mo->TotalSamples=(mo->srcSize<<3)/(mo->BitsPerSample*mo->Channels); SamplesLeft=(mo->TotalSamples-mo->WrittenSamples)+mo->frameSize; dur=SamplesLeft>mo->frameSize ? mo->frameSize : SamplesLeft; } if(bytesEncoded>0) { if(!(bytesWritten=MP4WriteSample(mo->MP4File, mo->MP4track, (unsigned __int8 *)mo->bitbuf, (DWORD)bytesEncoded, dur, mo->ofs, true) ? bytesEncoded : -1)) return ERROR_processData("MP4WriteSample()"); mo->ofs=0; mo->WrittenSamples+=dur; } } showProgress(mo); GlobalUnlock(hOutput); return bytesWritten; } // ----------------------------------------------------------------------------------------------- int Cfaac::processDataBufferized(HANDLE hOutput, BYTE *bufIn, long lBytes) { if(!hOutput) return -1; int bytesWritten=0, tot=0; MYOUTPUT far *mo; GLOBALLOCK(mo,hOutput,MYOUTPUT,return 0); if(mo->bytes_into_buffer>=0) do { if(mo->bytes_into_buffer+lBytessamplesInputSize) { memmove(mo->bufIn+mo->bytes_into_buffer, bufIn, lBytes); mo->bytes_into_buffer+=lBytes; lBytes=0; } else { int shift=mo->samplesInputSize-mo->bytes_into_buffer; memmove(mo->bufIn+mo->bytes_into_buffer, bufIn, shift); mo->bytes_into_buffer+=shift; bufIn+=shift; lBytes-=shift; tot+=bytesWritten=processData(hOutput,mo->bufIn,mo->bytes_into_buffer); if(bytesWritten<0) return ERROR_processData(0); mo->bytes_into_buffer=0; } }while(lBytes); GlobalUnlock(hOutput); return tot; } faac-1.28/common/Cfaac/Cfaac.h0000644010307701030770000001134010141510623017467 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #ifndef _Cfaac_H #define _Cfaac_H // ********************************************************************************************* #include // int32_t, ... #include //#include // FAAD2 version #ifdef MAIN #undef MAIN #endif #ifdef SSR #undef SSR #endif #ifdef LTP #undef LTP #endif #define HAVE_INT32_T #include #include // mpeg4ip version #include #include #include "Defines.h" // my defines // ********************************************************************************************* #ifdef ADTS #undef ADTS #define ADTS 1 #endif // ********************************************************************************************* #define REG_AUTO "Auto" #define DEF_AUTO true #define REG_WRITEMP4 "Write MP4" #define DEF_WRITEMP4 0 #define REG_MPEGVER "MPEG version" #define DEF_MPEGVER MPEG4 #define REG_PROFILE "Profile" #define DEF_PROFILE LOW #define REG_MIDSIDE "MidSide" #define DEF_MIDSIDE true #define REG_TNS "TNS" #define DEF_TNS true #define REG_LFE "LFE" #define DEF_LFE false #define REG_USEQUALTY "Use quality" #define DEF_USEQUALTY true #define REG_QUALITY "Quality" #define DEF_QUALITY 100 #define REG_BITRATE "BitRate" #define DEF_BITRATE 0 /* quality on */ #define REG_BANDWIDTH "BandWidth" #define DEF_BANDWIDTH 0 #define REG_HEADER "Header" #define DEF_HEADER ADTS #define REG_OutFolder "Output folder" #define REG_InFolder "Source folder" #define REG_SrcExt "Source extensions" // ********************************************************************************************* class CMyEncCfg { private: bool SaveCfgOnDestroy; public: CMyEncCfg(bool SaveOnDestroy=true) { OutDir=TagSrcPath=TagSrcExt=NULL; getCfg(this); SaveCfgOnDestroy=SaveOnDestroy; } virtual ~CMyEncCfg() { if(SaveCfgOnDestroy) setCfg(this); FreeCfg(this); } void FreeCfg(CMyEncCfg *cfg) { Tag.FreeTag(); FREE_ARRAY(OutDir); FREE_ARRAY(TagSrcPath); FREE_ARRAY(TagSrcExt); } void getCfg(CMyEncCfg *cfg); void setCfg(CMyEncCfg *cfg); bool AutoCfg, UseQuality; BYTE SaveMP4; char *OutDir; faacEncConfiguration EncCfg; CMP4Tag Tag; BYTE TagOn; BYTE TagImport; char *TagSrcPath, *TagSrcExt; }; // ----------------------------------------------------------------------------------------------- typedef struct output_tag // any special vars associated with output file { // MP4 MP4FileHandle MP4File; MP4TrackId MP4track; MP4Duration TotalSamples, WrittenSamples, encoded_samples; DWORD frameSize, ofs; // AAC FILE *aacFile; char *InFilename, *OutFilename; // GLOBAL long Samprate; WORD BitsPerSample; WORD Channels; DWORD srcSize; //char *dst_name; // name of compressed file faacEncHandle hEncoder; int32_t *buf32bit; BYTE *bufIn; unsigned char *bitbuf; long bytes_into_buffer; DWORD maxBytesOutput; long samplesInput, samplesInputSize; bool WriteMP4; } MYOUTPUT; // ********************************************************************************************* class Cfaac { private: virtual void DisplayError(char *ProcName, char *str); virtual HANDLE ERROR_Init(char *str) { DisplayError("Init", str); return NULL; } virtual int ERROR_processData(char *str) { DisplayError("processData", str); return -1; } virtual void showInfo(MYOUTPUT *mi) {} virtual void showProgress(MYOUTPUT *mi) {} void To32bit(int32_t *buf, BYTE *bufi, int size, BYTE samplebytes, BYTE bigendian); public: Cfaac(HANDLE hOutput=NULL); virtual ~Cfaac(); virtual char *getSourceFilename(char *path, char *src, char *ext); virtual HANDLE Init(LPSTR InFilename,LPSTR OutFilename,long lSamprate,WORD wBitsPerSample,WORD wChannels,long FileSize); virtual int processData(HANDLE hOutput, BYTE *bufIn, DWORD len); virtual int processDataBufferized(HANDLE hOutput, BYTE *bufIn, long lBytes); /* // AAC bool BlockSeeking; // GLOBAL long newpos_ms; BOOL IsSeekable; MYINPUT *mi; */ HANDLE hOutput; // bool dontAskGetFilename; }; #endif faac-1.28/common/Cfaac/Cfaad.cpp0000644010307701030770000005644410141510624020042 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include "Cfaad.h" // ********************************************************************************************* Cfaad::Cfaad(HANDLE hIn) { ShowDlg4RawAAC=NULL; pCfg=NULL; if(hIn) { hInput=hIn; return; } MYINPUT *mi; if(!(hInput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT,sizeof(MYINPUT)))) MessageBox(0, "Memory allocation error: hInput", APP_NAME " plugin", MB_OK|MB_ICONSTOP); \ if(!(mi=(MYINPUT *)GlobalLock(hInput))) MessageBox(0, "GlobalLock(hInput)", APP_NAME " plugin", MB_OK|MB_ICONSTOP); \ /* mi->mp4File=0; mi->aacFile=0; mi->hDecoder=0; mi->buffer=0; mi->bytes_read=0;*/ mi->BitsPerSample=16; mi->FindBitrate=FALSE; newpos_ms=-1; mi->seek_table=NULL; mi->seek_table_length=0; mi->LockSeeking=false; GlobalUnlock(hInput); } // ----------------------------------------------------------------------------------------------- Cfaad::~Cfaad() { MYINPUT *mi; if(!hInput) return; GLOBALLOCK(mi,hInput,MYINPUT,return); if(mi->mp4File) MP4Close(mi->mp4File); if(mi->aacFile) fclose(mi->aacFile); if(mi->hDecoder) faacDecClose(mi->hDecoder); FREE_ARRAY(mi->buffer); FREE_ARRAY(mi->seek_table); GlobalUnlock(hInput); GlobalFree(hInput); } // ********************************************************************************************* // Utilities // ********************************************************************************************* int Cfaad::GetAACTrack(MP4FileHandle infile) { // find AAC track int i, rc; int numTracks = MP4GetNumberOfTracks(infile, NULL, 0); for (i = 0; i < numTracks; i++) { MP4TrackId trackId = MP4FindTrackId(infile, i, NULL, 0); const char* trackType = MP4GetTrackType(infile, trackId); if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) { unsigned char *buff = NULL; unsigned __int32 buff_size = 0; mp4AudioSpecificConfig mp4ASC; MP4GetTrackESConfiguration(infile, trackId, (unsigned __int8 **)&buff, &buff_size); if (buff) { rc = AudioSpecificConfig(buff, buff_size, &mp4ASC); free(buff); if (rc < 0) return -1; return trackId; } } } // can't decode this return -1; } // ********************************************************************************************* int Cfaad::IsMP4(LPSTR lpstrFilename) { DWORD mp4file = 0; FILE *hMP4File = fopen(lpstrFilename, "rb"); BYTE header[8]; if(!hMP4File) return -1; fread(header, 1, 8, hMP4File); fclose(hMP4File); if(header[4]=='f' && header[5]=='t' && header[6]=='y' && header[7]=='p') return 1; return 0; } // ********************************************************************************************* long Cfaad::id3v2_TagSize(unsigned char *buffer) { if(StringComp((const char *)buffer, "ID3", 3) == 0) { unsigned long tagsize; // high bit is not used tagsize = (buffer[6] << 21) | (buffer[7] << 14) | (buffer[8] << 7) | (buffer[9] << 0); tagsize += 10; return tagsize; } return 0; } /* long Cfaad::id3v2_TagSize(aac_buffer *b) { DWORD tagsize = 0; if (!memcmp(b->buffer, "ID3", 3)) { // high bit is not used tagsize = (b->buffer[6] << 21) | (b->buffer[7] << 14) | (b->buffer[8] << 7) | (b->buffer[9] << 0); tagsize += 10; advance_buffer(b, tagsize); fill_buffer(b); } return tagsize; } // ********************************************************************************************* int Cfaad::fill_buffer(aac_buffer *b) { int bread; if (b->bytes_consumed > 0) { if (b->bytes_into_buffer) { memmove((void*)b->buffer, (void*)(b->buffer + b->bytes_consumed), b->bytes_into_buffer*sizeof(unsigned char)); } if (!b->at_eof) { bread = fread((void*)(b->buffer + b->bytes_into_buffer), 1, b->bytes_consumed, b->infile); if (bread != b->bytes_consumed) b->at_eof = 1; b->bytes_into_buffer += bread; } b->bytes_consumed = 0; if (b->bytes_into_buffer > 3) { if (memcmp(b->buffer, "TAG", 3) == 0) b->bytes_into_buffer = 0; } if (b->bytes_into_buffer > 11) { if (memcmp(b->buffer, "LYRICSBEGIN", 11) == 0) b->bytes_into_buffer = 0; } if (b->bytes_into_buffer > 8) { if (memcmp(b->buffer, "APETAGEX", 8) == 0) b->bytes_into_buffer = 0; } } return 1; } // ********************************************************************************************* void Cfaad::advance_buffer(aac_buffer *b, int bytes) { b->file_offset += bytes; b->bytes_consumed = bytes; b->bytes_into_buffer -= bytes; } // ********************************************************************************************* static int adts_sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350,0,0,0}; int Cfaad::adts_parse(aac_buffer *b, int *bitrate, float *length) { int frames, frame_length; int t_framelength = 0; int samplerate; float frames_per_sec, bytes_per_frame; // Read all frames to ensure correct time and bitrate for (frames = 0; ; frames++) { fill_buffer(b); if (b->bytes_into_buffer > 7) { // check syncword if (!((b->buffer[0] == 0xFF)&&((b->buffer[1] & 0xF6) == 0xF0))) break; if (frames == 0) samplerate = adts_sample_rates[(b->buffer[2]&0x3c)>>2]; frame_length = ((((unsigned int)b->buffer[3] & 0x3)) << 11) | (((unsigned int)b->buffer[4]) << 3) | (b->buffer[5] >> 5); t_framelength += frame_length; if (frame_length > b->bytes_into_buffer) break; advance_buffer(b, frame_length); } else { break; } } frames_per_sec = (float)samplerate/1024.0f; if (frames != 0) bytes_per_frame = (float)t_framelength/(float)(frames*1000); else bytes_per_frame = 0; *bitrate = (int)(8. * bytes_per_frame * frames_per_sec + 0.5); if (frames_per_sec != 0) *length = (float)frames/frames_per_sec; else *length = 1; return 1; } // ********************************************************************************************* // get AAC infos for printing void Cfaad::GetAACInfos(aac_buffer *b, DWORD *header_type, float *song_length, int *pbitrate, long filesize) { int bitrate=0; float length=0; int bread; long tagsize=id3v2_TagSize(b); *header_type = 0; b->file_offset=tagsize; if ((b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) { adts_parse(b, &bitrate, &length); fseek(b->infile, tagsize, SEEK_SET); bread = fread(b->buffer, 1, FAAD_MIN_STREAMSIZE*MAX_CHANNELS, b->infile); if (bread != FAAD_MIN_STREAMSIZE*MAX_CHANNELS) b->at_eof = 1; else b->at_eof = 0; b->bytes_into_buffer = bread; b->bytes_consumed = 0; b->file_offset = tagsize; *header_type = 1; } else if (memcmp(b->buffer, "ADIF", 4) == 0) { int skip_size = (b->buffer[4] & 0x80) ? 9 : 0; bitrate = ((unsigned int)(b->buffer[4 + skip_size] & 0x0F)<<19) | ((unsigned int)b->buffer[5 + skip_size]<<11) | ((unsigned int)b->buffer[6 + skip_size]<<3) | ((unsigned int)b->buffer[7 + skip_size] & 0xE0); length = (float)filesize; if (length != 0) { length = ((float)length*8.f)/((float)bitrate) + 0.5f; } bitrate = (int)((float)bitrate/1000.0f + 0.5f); *header_type = 2; } *song_length = length; *pbitrate=bitrate; } void Cfaad::GetAACInfos(char *Filename, aac_buffer *b, DWORD *header_type, float *song_length, int *pbitrate) { if(!(b->infile=fopen(Filename,"rb"))) { MessageBox(NULL,"Error opening file",NULL,MB_OK); return; } fseek(b->infile, 0, SEEK_END); long src_size=ftell(b->infile); fseek(b->infile, 0, SEEK_SET); if(!(b->buffer=(BYTE *)malloc(FAAD_STREAMSIZE))) { MessageBox(NULL,"Memory allocation error: b->buffer",NULL,MB_OK); return; } int tread=src_sizebytes_into_buffer=fread(b->buffer, 1, tread, b->infile); if(b->bytes_into_buffer!=tread) { MessageBox(NULL,"Read failed!",NULL,MB_OK); return; } b->bytes_consumed=0; b->file_offset=0; b->at_eof=(b->bytes_into_buffer!=tread) ? 1 : 0; *header_type = 0; b->file_offset=0; GetAACInfos(b,header_type,song_length,pbitrate,src_size); free(b->buffer); fclose(b->infile); } */ // ********************************************************************************************* // Main functions // ********************************************************************************************* void CMyDecCfg::getCfg(CMyDecCfg *cfg) { CRegistry reg; if(reg.OpenCreate(HKEY_CURRENT_USER, REGISTRY_PROGRAM_NAME "\\FAAD")) { cfg->DefaultCfg=reg.GetSetBool(REG_DEFAULT,true); cfg->DecCfg.defObjectType=reg.GetSetByte(REG_PROFILE,LC); cfg->DecCfg.defSampleRate=reg.GetSetDword(REG_SAMPLERATE,44100); cfg->DecCfg.outputFormat=reg.GetSetByte(REG_BPS,FAAD_FMT_16BIT); cfg->DecCfg.downMatrix=reg.GetSetByte(REG_DOWNMATRIX,0); cfg->DecCfg.useOldADTSFormat=reg.GetSetByte(REG_OLDADTS,0); cfg->DecCfg.dontUpSampleImplicitSBR=reg.GetSetByte(REG_DONTUPSAMPLESBR,1); // cfg->Channels=reg.GetSetByte("Channels",2); } else MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP); } // ----------------------------------------------------------------------------------------------- void CMyDecCfg::setCfg(CMyDecCfg *cfg) { CRegistry reg; if(reg.OpenCreate(HKEY_CURRENT_USER, REGISTRY_PROGRAM_NAME "\\FAAD")) { reg.SetBool(REG_DEFAULT,cfg->DefaultCfg); reg.SetByte(REG_PROFILE,cfg->DecCfg.defObjectType); reg.SetDword(REG_SAMPLERATE,cfg->DecCfg.defSampleRate); reg.SetByte(REG_BPS,cfg->DecCfg.outputFormat); reg.SetByte(REG_DOWNMATRIX,cfg->DecCfg.downMatrix); reg.SetByte(REG_OLDADTS,cfg->DecCfg.useOldADTSFormat); reg.SetByte(REG_DONTUPSAMPLESBR,cfg->DecCfg.dontUpSampleImplicitSBR); // reg.SetByte("Channels",cfg->Channels); } else MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP); } // ********************************************************************************************* void Cfaad::setFaadCfg(faacDecHandle hDecoder, CMyDecCfg Cfg) { faacDecConfigurationPtr config=faacDecGetCurrentConfiguration(hDecoder); if(!Cfg.DefaultCfg) { config->defObjectType=Cfg.DecCfg.defObjectType; config->outputFormat=Cfg.DecCfg.outputFormat; config->defSampleRate=Cfg.DecCfg.defSampleRate; config->downMatrix=Cfg.DecCfg.downMatrix; config->useOldADTSFormat=Cfg.DecCfg.useOldADTSFormat; config->dontUpSampleImplicitSBR=1; } else { config->defObjectType=LC; config->outputFormat=FAAD_FMT_16BIT; config->defSampleRate=44100; config->downMatrix=0; config->useOldADTSFormat=0; config->dontUpSampleImplicitSBR=1; } faacDecSetConfiguration(hDecoder, config); } // ----------------------------------------------------------------------------------------------- void Cfaad::setDefaultFaadCfg(faacDecHandle hDecoder, BOOL showDlg) { if(showDlg && ShowDlg4RawAAC) ShowDlg4RawAAC(); CMyDecCfg Cfg(false); setFaadCfg(hDecoder,Cfg); } // ----------------------------------------------------------------------------------------------- void Cfaad::DisplayError(char *ProcName, char *str) { MYINPUT *mi; char buf[100]=""; GlobalUnlock(hInput); // it wasn't done in getInfos() GLOBALLOCK(mi,hInput,MYINPUT,return); if(ProcName && *ProcName) sprintf(buf,"%s: ", ProcName); if(str && *str) strcat(buf,str); if(*buf && str) MessageBox(0, buf, APP_NAME " plugin", MB_OK|MB_ICONSTOP); mi->bytes_into_buffer=-1; GlobalUnlock(hInput); } // ********************************************************************************************* HANDLE Cfaad::getInfos(LPSTR lpstrFilename) { MYINPUT *mi; // test tags //CMyDecCfg cfg; cfg.Tag.ReadMp4Tag(lpstrFilename); //CMyDecCfg cfg; cfg.Tag.ReadAacTag(lpstrFilename); GLOBALLOCK(mi,hInput,MYINPUT,return NULL); // mi->IsAAC=strcmpi(lpstrFilename+lstrlen(lpstrFilename)-4,".aac")==0; if((mi->IsMP4=IsMP4(lpstrFilename))==-1) return ERROR_getInfos("Error opening file"); if(mi->IsMP4) // MP4 file --------------------------------------------------------------------- { MP4Duration length; unsigned __int32 buffer_size; DWORD timeScale; BYTE sf; mp4AudioSpecificConfig mp4ASC; if(!(mi->mp4File=MP4Read(lpstrFilename, 0))) return ERROR_getInfos("Error opening file"); if((mi->track=GetAACTrack(mi->mp4File))<0) return ERROR_getInfos(0); //"Unable to find correct AAC sound track"); if(!(mi->hDecoder=faacDecOpen())) return ERROR_getInfos("Error initializing decoder library"); MP4GetTrackESConfiguration(mi->mp4File, mi->track, (unsigned __int8 **)&mi->buffer, &buffer_size); if(!mi->buffer) return ERROR_getInfos("MP4GetTrackESConfiguration()"); AudioSpecificConfig(mi->buffer, buffer_size, &mp4ASC); timeScale = mp4ASC.samplingFrequency; mi->Channels=mp4ASC.channelsConfiguration; sf = mp4ASC.samplingFrequencyIndex; mi->type = mp4ASC.objectTypeIndex; // mi->SBR=mp4ASC.sbr_present_flag; if(faacDecInit2(mi->hDecoder, mi->buffer, buffer_size, &mi->Samprate, &mi->Channels) < 0) return ERROR_getInfos("Error initializing decoder library"); FREE_ARRAY(mi->buffer); length=MP4GetTrackDuration(mi->mp4File, mi->track); mi->len_ms=(DWORD)MP4ConvertFromTrackDuration(mi->mp4File, mi->track, length, MP4_MSECS_TIME_SCALE); mi->file_info.bitrate=MP4GetTrackBitRate(mi->mp4File, mi->track); mi->file_info.version=MP4GetTrackAudioType(mi->mp4File, mi->track)==MP4_MPEG4_AUDIO_TYPE ? 4 : 2; mi->numSamples=MP4GetTrackNumberOfSamples(mi->mp4File, mi->track); mi->sampleId=1; mi->IsSeekable=true; mi->LockSeeking=!mi->IsSeekable; } else // AAC file ------------------------------------------------------------------------------ { DWORD read, tmp; BYTE Channels4Raw=0; if(!(mi->aacFile=fopen(lpstrFilename,"rb"))) return ERROR_getInfos("Error opening file"); // use bufferized stream setvbuf(mi->aacFile,NULL,_IOFBF,32767); // get size of file fseek(mi->aacFile, 0, SEEK_END); mi->src_size=ftell(mi->aacFile); fseek(mi->aacFile, 0, SEEK_SET); if(!(mi->buffer=(BYTE *)malloc(FAAD_STREAMSIZE))) return ERROR_getInfos("Memory allocation error: mi->buffer"); tmp=mi->src_sizesrc_size : FAAD_STREAMSIZE; read=fread(mi->buffer, 1, tmp, mi->aacFile); if(read==tmp) { mi->bytes_read=read; mi->bytes_into_buffer=read; } else return ERROR_getInfos("Read failed!"); // skip Tag long tagsize; if(tagsize=id3v2_TagSize(mi->buffer)) { if(tagsize>(long)mi->src_size) ERROR_getInfos("Corrupt stream!"); if(tagsizebytes_into_buffer) { mi->bytes_into_buffer-=tagsize; memcpy(mi->buffer,mi->buffer+tagsize,mi->bytes_into_buffer); } else { mi->bytes_read=tagsize; mi->bytes_into_buffer=0; if(tagsize>mi->bytes_into_buffer) fseek(mi->aacFile, tagsize, SEEK_SET); } if(mi->src_sizebytes_read+FAAD_STREAMSIZE-mi->bytes_into_buffer) tmp=mi->src_size-mi->bytes_read; else tmp=FAAD_STREAMSIZE-mi->bytes_into_buffer; read=fread(mi->buffer+mi->bytes_into_buffer, 1, tmp, mi->aacFile); if(read==tmp) { mi->bytes_read+=read; mi->bytes_into_buffer+=read; } else ERROR_getInfos("Read failed!"); } if(get_AAC_format(lpstrFilename, &mi->file_info, &mi->seek_table, &mi->seek_table_length, 0)) ERROR_getInfos("get_AAC_format()"); mi->IsSeekable=mi->file_info.headertype==ADTS && mi->seek_table && mi->seek_table_length>0; mi->LockSeeking=!mi->IsSeekable; /* aac_buffer b; float fLength; DWORD headertype; b.infile=mi->aacFile; b.buffer=mi->buffer; b.bytes_into_buffer=read; b.bytes_consumed=mi->bytes_consumed; b.file_offset=0; b.at_eof=(read!=tmp) ? 1 : 0; GetAACInfos(&b,&headertype,&fLength,&mi->file_info.bitrate,mi->src_size); mi->file_info.bitrate*=1024; mi->file_info.headertype=headertype; mi->bytes_into_buffer=b.bytes_into_buffer; mi->bytes_consumed=b.bytes_consumed; IsSeekable=false; // only mp4 can be seeked */ if(!mi->FindBitrate) // open a new instance to get info from decoder { MYINPUT *miTmp; Cfaad *NewInst; if(!(NewInst=new Cfaad())) return ERROR_getInfos("Memory allocation error: NewInst"); GLOBALLOCK(miTmp,NewInst->hInput,MYINPUT,return 0); miTmp->FindBitrate=TRUE; NewInst->ShowDlg4RawAAC=ShowDlg4RawAAC; NewInst->pCfg=pCfg; if(!NewInst->getInfos(lpstrFilename)) return ERROR_getInfos(0); mi->Channels=miTmp->frameInfo.channels; if(mi->file_info.headertype==RAW) mi->file_info.bitrate=miTmp->file_info.bitrate;//*mi->Channels; mi->Samprate=miTmp->Samprate; mi->file_info.headertype=miTmp->file_info.headertype; mi->file_info.object_type=miTmp->file_info.object_type; mi->file_info.version=miTmp->file_info.version; GlobalUnlock(NewInst->hInput); delete NewInst; } if(!(mi->hDecoder=faacDecOpen())) return ERROR_getInfos("Can't open library"); if(mi->file_info.headertype==RAW) if(pCfg) setFaadCfg(mi->hDecoder,*pCfg); else setDefaultFaadCfg(mi->hDecoder,mi->FindBitrate); BYTE Channels; // faacDecInit doesn't report correctly the number of channels in raw aac files if((mi->bytes_consumed=faacDecInit(mi->hDecoder, mi->buffer, mi->bytes_into_buffer, &mi->Samprate, &Channels))<0) return ERROR_getInfos("faacDecInit()"); mi->bytes_into_buffer-=mi->bytes_consumed; if(mi->FindBitrate) // get info from decoder { DWORD Samples, BytesConsumed; if(!processData(hInput,0,0)) return ERROR_getInfos(0); Samples=mi->frameInfo.samples/sizeof(short); BytesConsumed=mi->frameInfo.bytesconsumed; if(mi->file_info.headertype==RAW || !mi->file_info.bitrate) mi->file_info.bitrate=(BytesConsumed*8*mi->Samprate)/(Samples*2); if(!mi->file_info.bitrate) return ERROR_getInfos("Can't determine the bitrate"); } mi->len_ms=(DWORD)((mi->src_size<<3)/(mi->file_info.bitrate>>10)); // mi->len_ms=(DWORD)((1000*((float)mi->src_size*8))/mi->file_info.bitrate); } if(mi->len_ms) mi->dst_size=(DWORD)(mi->len_ms*((float)mi->Samprate/1000)*mi->Channels*(mi->BitsPerSample/8)); else return ERROR_getInfos("Can't determine the length"); showInfo(mi); GlobalUnlock(hInput); return hInput; } // ********************************************************************************************* int Cfaad::processData(HANDLE hInput, unsigned char far *bufout, long lBytes) { BYTE *buffer; DWORD BytesDecoded=0; char *sample_buffer=0; int read; MYINPUT *mi; GLOBALLOCK(mi,hInput,MYINPUT,return 0); if(mi->LockSeeking) { NoSeek(); mi->LockSeeking=false; } if(mi->IsMP4) // MP4 file -------------------------------------------------------------------------- { unsigned __int32 buffer_size=0; int rc; if(newpos_ms>-1) { MP4Duration duration=MP4ConvertToTrackDuration(mi->mp4File,mi->track,newpos_ms,MP4_MSECS_TIME_SCALE); MP4SampleId sampleId=MP4GetSampleIdFromTime(mi->mp4File,mi->track,duration,0); mi->bytes_read=(DWORD)(((float)newpos_ms*mi->file_info.bitrate)/(8*1000)); if(seek(mi->bytes_read)) // update the slider return ERROR_processData(0); newpos_ms=-1; } do { buffer=NULL; if(mi->sampleId>=mi->numSamples) return ERROR_processData(0); rc=MP4ReadSample(mi->mp4File, mi->track, mi->sampleId++, (unsigned __int8 **)&buffer, &buffer_size, NULL, NULL, NULL, NULL); if(rc==0 || buffer==NULL) { FREE_ARRAY(buffer); return ERROR_processData("MP4ReadSample()"); } sample_buffer=(char *)faacDecDecode(mi->hDecoder,&mi->frameInfo,buffer,buffer_size); BytesDecoded=mi->frameInfo.samples*sizeof(short); if(BytesDecoded>(DWORD)lBytes) BytesDecoded=lBytes; memmove(bufout,sample_buffer,BytesDecoded); FREE_ARRAY(buffer); // to update the slider mi->bytes_read+=buffer_size; if(seek(mi->bytes_read)) return ERROR_processData(0); }while(!BytesDecoded && !mi->frameInfo.error); } else // AAC file -------------------------------------------------------------------------- { if(newpos_ms>-1) { if(mi->IsSeekable) { DWORD normalized=mi->len_ms/(mi->seek_table_length-1); if(normalized<1000) normalized=1000; mi->bytes_read=mi->seek_table[newpos_ms/normalized]; fseek(mi->aacFile, mi->bytes_read, SEEK_SET); if(seek(mi->bytes_read)) // update the slider return ERROR_processData(0); mi->bytes_into_buffer=0; mi->bytes_consumed=FAAD_STREAMSIZE; } newpos_ms=-1; } buffer=mi->buffer; do { if(mi->bytes_consumed>0) { if(mi->bytes_into_buffer) memmove(buffer,buffer+mi->bytes_consumed,mi->bytes_into_buffer); if(mi->bytes_readsrc_size) { int tmp; if(mi->bytes_read+mi->bytes_consumedsrc_size) tmp=mi->bytes_consumed; else tmp=mi->src_size-mi->bytes_read; read=fread(buffer+mi->bytes_into_buffer, 1, tmp, mi->aacFile); if(read==tmp) { mi->bytes_read+=read; mi->bytes_into_buffer+=read; } } else if(mi->bytes_into_buffer) memset(buffer+mi->bytes_into_buffer, 0, mi->bytes_consumed); mi->bytes_consumed=0; if( (mi->bytes_into_buffer>3 && !memcmp(mi->buffer, "TAG", 3)) || (mi->bytes_into_buffer>11 && !memcmp(mi->buffer, "LYRICSBEGIN", 11)) || (mi->bytes_into_buffer>8 && !memcmp(mi->buffer, "APETAGEX", 8))) return ERROR_processData(0); } if(mi->bytes_into_buffer<1) if(mi->bytes_readsrc_size) return ERROR_processData("Buffer empty!"); else return ERROR_processData(0); sample_buffer=(char *)faacDecDecode(mi->hDecoder,&mi->frameInfo,buffer,mi->bytes_into_buffer); BytesDecoded=mi->frameInfo.samples*sizeof(short); if(bufout) { if(BytesDecoded>(DWORD)lBytes) BytesDecoded=lBytes; if(sample_buffer && BytesDecoded && !mi->frameInfo.error) memmove(bufout,sample_buffer,BytesDecoded); } else // Data needed to decode Raw files { mi->Channels=mi->frameInfo.channels; mi->file_info.object_type=mi->frameInfo.object_type; } mi->bytes_consumed+=mi->frameInfo.bytesconsumed; mi->bytes_into_buffer-=mi->bytes_consumed; }while(!BytesDecoded && !mi->frameInfo.error); } // END AAC file -------------------------------------------------------------------------- if(mi->frameInfo.error) return ERROR_processData((char *)faacDecGetErrorMessage(mi->frameInfo.error)); showProgress(mi); GlobalUnlock(hInput); return BytesDecoded; } faac-1.28/common/Cfaac/Cfaad.h0000644010307701030770000001337510141510624017503 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #ifndef _Cfaad_H #define _Cfaad_H #include #define HAVE_INT32_T #include #ifdef MAIN #undef MAIN #endif #ifdef SSR #undef SSR #endif #ifdef LTP #undef LTP #endif #include //#include extern "C" { #include // get_AAC_format() } #include "Defines.h" #include #include // ********************************************************************************************* // make this higher to support files with more channels #define MAX_CHANNELS 6 #if FAAD_MIN_STREAMSIZE<2048 #undef FAAD_MIN_STREAMSIZE // 960 for LD or else 1024 (expanded to 2048 for HE-AAC) #define FAAD_MIN_STREAMSIZE 2048 #endif #define FAAD_STREAMSIZE (FAAD_MIN_STREAMSIZE*MAX_CHANNELS) // ----------------------------------------------------------------------------------------------- #define REG_DEFAULT "Default" #define REG_PROFILE "Profile" #define REG_SAMPLERATE "SampleRate" #define REG_BPS "Bps" #define REG_DOWNMATRIX "Downmatrix" #define REG_OLDADTS "Old ADTS" #define REG_DONTUPSAMPLESBR "Don\'t upsample implicit SBR" // ********************************************************************************************* /* FAAD file buffering routines */ /*typedef struct { long bytes_into_buffer; long bytes_consumed; long file_offset; unsigned char *buffer; int at_eof; FILE *infile; } aac_buffer; // ----------------------------------------------------------------------------------------------- typedef struct { int version; int channels; int sampling_rate; int bitrate; int length; int object_type; int headertype; } faadAACInfo; */ // ********************************************************************************************* class CMyDecCfg { private: bool SaveCfgOnDestroy; public: CMyDecCfg(bool SaveOnDestroy=true) { getCfg(this); SaveCfgOnDestroy=SaveOnDestroy; } virtual ~CMyDecCfg() { if(SaveCfgOnDestroy) setCfg(this); FreeCfg(this); } void FreeCfg(CMyDecCfg *cfg) { cfg->Tag.FreeTag(); } void FreeCfg() { this->Tag.FreeTag(); } void getCfg(CMyDecCfg *cfg); void getCfg() { getCfg(this); } void setCfg(CMyDecCfg *cfg); void setCfg() { setCfg(this); } bool DefaultCfg; BYTE Channels; DWORD BitRate; faacDecConfiguration DecCfg; CMP4Tag Tag; }; // ----------------------------------------------------------------------------------------------- typedef struct input_tag // any special vars associated with input file { //MP4 MP4FileHandle mp4File; MP4SampleId sampleId, numSamples; int track; BYTE type; //AAC FILE *aacFile; DWORD src_size; // size of compressed file long tagsize; DWORD bytes_read; // from file long bytes_consumed; // from buffer by faadDecDecode long bytes_into_buffer; unsigned char *buffer; DWORD *seek_table; int seek_table_length; // Raw AAC BOOL FindBitrate; // GLOBAL faacDecHandle hDecoder; faadAACInfo file_info; faacDecFrameInfo frameInfo; DWORD len_ms; // length of file in milliseconds BYTE Channels; DWORD Samprate; WORD BitsPerSample; DWORD dst_size; // size of decoded file. Cooledit needs it to update its progress bar //char *src_name; // name of compressed file int IsMP4; bool LockSeeking, IsSeekable; } MYINPUT; // ----------------------------------------------------------------------------------------------- class Cfaad { private: virtual int GetAACTrack(MP4FileHandle infile); long id3v2_TagSize(unsigned char *buffer); /* long id3v2_TagSize(aac_buffer *b); int fill_buffer(aac_buffer *b); void advance_buffer(aac_buffer *b, int bytes); int adts_parse(aac_buffer *b, int *bitrate, float *length); void GetAACInfos(aac_buffer *b, DWORD *header_type, float *song_length, int *pbitrate, long filesize); */ virtual void DisplayError(char *ProcName, char *str); virtual HANDLE ERROR_getInfos(char *str) { DisplayError("getInfos", str); return NULL; } virtual int ERROR_processData(char *str) { DisplayError("processData", str); return 0; } virtual void showInfo(MYINPUT *mi) {} virtual void showProgress(MYINPUT *mi) {} virtual void setDefaultFaadCfg(faacDecHandle hDecoder, BOOL showDlg); virtual void setFaadCfg(faacDecHandle hDecoder, CMyDecCfg Cfg); virtual int seek(int newpos_bytes) { return 0; } // !=0 => error virtual void NoSeek() {} // put here the code to block seeking of player public: Cfaad(HANDLE hInput=NULL); virtual ~Cfaad(); int (*ShowDlg4RawAAC)(); // set this to show your dialog (to decode raw aac files) int IsMP4(LPSTR lpstrFilename); inline bool CanSeek() { MYINPUT *mi; GLOBALLOCK(mi,hInput,MYINPUT,return 0); bool IsSeekable=mi->IsSeekable; GlobalUnlock(hInput); return IsSeekable; } // virtual void GetAACInfos(char *Filename, aac_buffer *b, DWORD *header_type, float *song_length, int *pbitrate); virtual HANDLE getInfos(LPSTR lpstrFilename); virtual int processData(HANDLE hInput, unsigned char far *bufout, long lBytes); // GLOBAL long newpos_ms; // set this to change position HANDLE hInput; CMyDecCfg *pCfg; // set this to use your cfg (to decode raw aac files) }; #endif faac-1.28/common/Cfaac/DecDialog.cpp0000644010307701030770000001544510141510626020655 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include #include "resource.h" #include // my defines #include "Cfaad.h" #include "DecDialog.h" #include "EncDialog.h" // ********************************************************************************************* extern HINSTANCE hInstance; extern HBITMAP hBmBrowse; // ----------------------------------------------------------------------------------------------- #ifndef FAAD_FMT_64BIT #define FAAD_FMT_64BIT 5 #endif // ********************************************************************************************* int ShowDlg4RawAAC() { return DialogBoxParam((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_DECODER),(HWND)NULL, (DLGPROC)DialogMsgProcDec, 0); // return DialogBoxParam((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_DECODER),(HWND)hWnd, (DLGPROC)DialogMsgProcDec, (DWORD)&cfg); } // ********************************************************************************************* #define INIT_CB(hWnd,nID,list,IdSelected) \ { \ for(int i=0; list[i]; i++) \ SendMessage(GetDlgItem(hWnd, nID), CB_ADDSTRING, 0, (LPARAM)list[i]); \ SendMessage(GetDlgItem(hWnd, nID), CB_SETCURSEL, IdSelected, 0); \ } // ----------------------------------------------------------------------------------------------- // EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_SSR), Enabled); #define DISABLE_CTRLS_DEC(Enabled) \ { \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MAIN), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LOW), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_DOWNMATRIX), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_OLDADTS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_SAMPLERATE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), Enabled); \ } // ----------------------------------------------------------------------------------------------- BOOL DialogMsgProcDec(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: { /* if(!lParam) { MessageBox(hWndDlg,"Pointer==NULL",0,MB_OK|MB_ICONSTOP); EndDialog(hWndDlg, 0); return TRUE; } */ char buf[50]; char *SampleRate[]={"6000","8000","16000","22050","32000","44100","48000","64000","88200","96000","192000",0}, *BitsPerSample[]={"16","24","32","32 bit FLOAT","64 bit FLOAT",0}; CMyDecCfg cfg(false); SetWindowPos(GetDlgItem(hWndDlg,IDC_CHK_DEFAULTCFG),GetDlgItem(hWndDlg,IDC_GRP_DEFAULT),0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); INIT_CB(hWndDlg,IDC_CB_BITSPERSAMPLE,BitsPerSample,0); INIT_CB(hWndDlg,IDC_CB_SAMPLERATE,SampleRate,5); sprintf(buf,"%lu",cfg.DecCfg.defSampleRate); SetDlgItemText(hWndDlg, IDC_CB_SAMPLERATE, buf); switch(cfg.DecCfg.defObjectType) { case MAIN: CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); break; case LC: CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE); break; case SSR: CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE); break; case LTP: CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE); break; case HE_AAC: CheckDlgButton(hWndDlg,IDC_RADIO_HE,TRUE); break; } switch(cfg.DecCfg.outputFormat) { case FAAD_FMT_16BIT: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_SETCURSEL, 0, 0); break; case FAAD_FMT_24BIT: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_SETCURSEL, 1, 0); break; case FAAD_FMT_32BIT: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_SETCURSEL, 2, 0); break; case FAAD_FMT_FLOAT: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_SETCURSEL, 3, 0); break; case FAAD_FMT_64BIT: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_SETCURSEL, 4, 0); break; } CheckDlgButton(hWndDlg,IDC_CHK_DOWNMATRIX, cfg.DecCfg.downMatrix); CheckDlgButton(hWndDlg,IDC_CHK_OLDADTS, cfg.DecCfg.useOldADTSFormat); CheckDlgButton(hWndDlg,IDC_CHK_DEFAULTCFG, cfg.DefaultCfg); DISABLE_CTRLS_DEC(!cfg.DefaultCfg); } break; // End of WM_INITDIALOG case WM_CLOSE: // Closing the Dialog behaves the same as Cancel PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0); break; // End of WM_CLOSE case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_CHK_DEFAULTCFG: { char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_DEFAULTCFG); DISABLE_CTRLS_DEC(Enabled); } break; case IDOK: { CMyDecCfg cfg; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN)) cfg.DecCfg.defObjectType=MAIN; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW)) cfg.DecCfg.defObjectType=LC; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR)) cfg.DecCfg.defObjectType=SSR; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP)) cfg.DecCfg.defObjectType=LTP; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_HE)) cfg.DecCfg.defObjectType=HE_AAC; switch(SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITSPERSAMPLE), CB_GETCURSEL, 0, 0)) { case 0: cfg.DecCfg.outputFormat=FAAD_FMT_16BIT; break; case 1: cfg.DecCfg.outputFormat=FAAD_FMT_24BIT; break; case 2: cfg.DecCfg.outputFormat=FAAD_FMT_32BIT; break; case 3: cfg.DecCfg.outputFormat=FAAD_FMT_FLOAT; break; case 4: cfg.DecCfg.outputFormat=FAAD_FMT_64BIT; break; } cfg.DecCfg.defSampleRate=GetDlgItemInt(hWndDlg, IDC_CB_SAMPLERATE, 0, FALSE); cfg.DecCfg.downMatrix=IsDlgButtonChecked(hWndDlg,IDC_CHK_DOWNMATRIX) ? TRUE : FALSE; cfg.DecCfg.useOldADTSFormat=IsDlgButtonChecked(hWndDlg,IDC_CHK_OLDADTS) ? TRUE : FALSE; cfg.DefaultCfg=IsDlgButtonChecked(hWndDlg,IDC_CHK_DEFAULTCFG) ? TRUE : FALSE; EndDialog(hWndDlg, (DWORD)TRUE); } break; case IDCANCEL: // Ignore data values entered into the controls // and dismiss the dialog window returning FALSE EndDialog(hWndDlg, (DWORD)FALSE); break; case IDC_BTN_ABOUT: DialogBox((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout); break; } break; // End of WM_COMMAND default: return FALSE; } return TRUE; } faac-1.28/common/Cfaac/DecDialog.h0000644010307701030770000000137010141510626020312 0ustar fabian-guestfabian-guestextern BOOL DialogMsgProcDec(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam); extern int ShowDlg4RawAAC(); static const char* mpeg4AudioNames[]= { "Raw PCM", "AAC Main", "AAC LC (Low Complexity)", "AAC SSR", "AAC LTP (Long Term Prediction)", "AAC HE (High Efficiency)", "AAC Scalable", "TwinVQ", "CELP", "HVXC", "Reserved", "Reserved", "TTSI", "Main synthetic", "Wavetable synthesis", "General MIDI", "Algorithmic Synthesis and Audio FX", // defined in MPEG-4 version 2 "ER AAC LC (Low Complexity)", "Reserved", "ER AAC LTP (Long Term Prediction)", "ER AAC Scalable", "ER TwinVQ", "ER BSAC", "ER AAC LD (Low Delay)", "ER CELP", "ER HVXC", "ER HILN", "ER Parametric", "Reserved", "Reserved", "Reserved", "Reserved" }; faac-1.28/common/Cfaac/Email.bmp0000644010307701030770000001074410141510626020062 0ustar fabian-guestfabian-guestBM6(3ohm i 1v4 8B FI(Q  } 2  g"AMCv?r5h4g,W'N<2 v|}$ASMCv?r5h4g,W&L92  ~ %AZSMCv?r5h4g,W&L92s 'A0I.G(B'@!;8'N4g,W&L/oG[5h4g7Z$H^?r.I[#GIK%4Q&k"%9K@3x_o y:1*B9>*q&w~5|yfaac-1.28/common/Cfaac/EncDialog.cpp0000644010307701030770000007673510142153673020706 0ustar fabian-guestfabian-guest/* CFAAC - set of classes to import/export .aac/.mp4 files Copyright (C) 2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include #include // Browse #include // ShellExecute #include #include "resource.h" #include "Defines.h" // my defines #include "CTag.h" #include "Cfaac.h" #include "EncDialog.h" #include #include #include <..\..\common\id3lib\win32\config.h> // ID3LIB_FULLNAME // ********************************************************************************************* #ifdef USE_OUTPUT_FOLDER extern char config_AACoutdir[MAX_PATH]; #endif extern HINSTANCE hInstance; extern HBITMAP hBmBrowse; // ********************************************************************************************* /* DWORD PackCfg(MY_ENC_CFG *cfg) { DWORD dwOptions=0; if(cfg->AutoCfg) dwOptions=1<<31; dwOptions|=(DWORD)cfg->EncCfg.mpegVersion<<30; dwOptions|=(DWORD)cfg->EncCfg.aacObjectType<<28; dwOptions|=(DWORD)cfg->EncCfg.allowMidside<<27; dwOptions|=(DWORD)cfg->EncCfg.useTns<<26; dwOptions|=(DWORD)cfg->EncCfg.useLfe<<25; dwOptions|=(DWORD)cfg->EncCfg.outputFormat<<24; if(cfg->UseQuality) dwOptions|=(((DWORD)cfg->EncCfg.quantqual>>1)&0xff)<<16; // [2,512] else dwOptions|=(((DWORD)cfg->EncCfg.bitRate>>1)&0xff)<<16; // [2,512] if(cfg->UseQuality) dwOptions|=1<<15; dwOptions|=((DWORD)cfg->EncCfg.bandWidth>>1)&&0x7fff; // [0,65536] return dwOptions; } // ----------------------------------------------------------------------------------------------- void UnpackCfg(MY_ENC_CFG *cfg, DWORD dwOptions) { cfg->AutoCfg=dwOptions>>31; cfg->EncCfg.mpegVersion=(dwOptions>>30)&1; cfg->EncCfg.aacObjectType=(dwOptions>>28)&3; cfg->EncCfg.allowMidside=(dwOptions>>27)&1; cfg->EncCfg.useTns=(dwOptions>>26)&1; cfg->EncCfg.useLfe=(dwOptions>>25)&1; cfg->EncCfg.outputFormat=(dwOptions>>24)&1; cfg->EncCfg.bitRate=((dwOptions>>16)&0xff)<<1; cfg->UseQuality=(dwOptions>>15)&1; cfg->EncCfg.bandWidth=(dwOptions&0x7fff)<<1; }*/ // ----------------------------------------------------------------------------------------------- #define INIT_CB(hWnd,nID,list,FillList,IdSelected) \ { \ if(FillList) \ for(int i=0; list[i]; i++) \ SendMessage(GetDlgItem(hWnd, nID), CB_ADDSTRING, 0, (LPARAM)list[i]); \ SendMessage(GetDlgItem(hWnd, nID), CB_SETCURSEL, IdSelected, 0); \ } // ----------------------------------------------------------------------------------------------- #define INIT_CB_GENRES(hWnd,nID,ID3Genres,IdSelected) \ { \ for(int i=0; i<(sizeof(ID3Genres)/sizeof(ID3Genres[0])); i++) \ SendMessage(GetDlgItem(hWnd, nID), CB_ADDSTRING, 0, (LPARAM)ID3Genres[i].name); \ SendMessage(GetDlgItem(hWnd, nID), CB_SETCURSEL, IdSelected, 0); \ } // ----------------------------------------------------------------------------------------------- #define DISABLE_LTP \ { \ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG2) && \ IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP)) \ { \ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE); \ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); \ } \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE); \ } // ----------------------------------------------------------------------------------------------- // EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_SSR), Enabled); // EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USELFE), Enabled); #define DISABLE_CTRLS_ENC(Enabled) \ { \ CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG4), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG2), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_RAW), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_ADTS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_ALLOWMIDSIDE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USETNS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USELFE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_QUALITY), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_QUALITY), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_BITRATE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MAIN), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LOW), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4)) \ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \ else \ DISABLE_LTP \ } // ----------------------------------------------------------------------------------------------- #define ENABLE_TAG(Enabled) \ { \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_ARTIST), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_TITLE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_ALBUM), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_YEAR), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_GENRE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_WRITER), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_COMMENT), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_COMPILATION), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_COMPILATION), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_TRACK), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_NTRACKS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_DISK), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_NDISKS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_ARTFILE), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_BTN_ARTFILE), Enabled); \ } // ----------------------------------------------------------------------------------------------- #define ENABLE_AACTAGS(Enabled) \ { \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_COMPILATION), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_COMPILATION), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_NTRACKS), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_DISK), Enabled); \ EnableWindow(GetDlgItem(hWndDlg, IDC_E_NDISKS), Enabled); \ } // ----------------------------------------------------------------------------------------------- #ifdef USE_OUTPUT_FOLDER static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { if (uMsg == BFFM_INITIALIZED) { SetWindowText(hwnd,"Select folder"); SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)TRUE,(LPARAM)lpData); } return 0; } #else #ifdef USE_IMPORT_TAG static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { if (uMsg == BFFM_INITIALIZED) { SetWindowText(hwnd,"Select folder"); SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)TRUE,(LPARAM)lpData); } return 0; } #endif #endif // ----------------------------------------------------------------------------------------------- BOOL DialogMsgProcAbout(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: { char buf[512]; char *faac_id_string, *faac_copyright_string; sprintf(buf, APP_NAME " plugin " APP_VER " by Antonio Foranna\n\n" "Libraries used:\n" "\tlibfaac v%s\n" "\tFAAD2 v" FAAD2_VERSION "\n" "\t" MPEG4IP_PACKAGE " v" MPEG4IP_VERSION "\n" "\t" ID3LIB_FULLNAME "\n\n" "This code is given with FAAC package and does not contain executables.\n" "This program is free software and can be distributed/modifyed under the terms of the GNU General Public License.\n" "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.\n\n" "Compiled on %s\n", (faacEncGetVersion(&faac_id_string, &faac_copyright_string)==FAAC_CFG_VERSION) ? faac_id_string : " wrong libfaac version", __DATE__ ); SetDlgItemText(hWndDlg, IDC_L_ABOUT, buf); } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: EndDialog(hWndDlg, TRUE); break; case IDCANCEL: // Ignore data values entered into the controls and dismiss the dialog window returning FALSE EndDialog(hWndDlg, FALSE); break; case IDC_AUDIOCODING: ShellExecute(hWndDlg, NULL, "http://www.audiocoding.com", NULL, NULL, SW_SHOW); break; case IDC_MPEG4IP: ShellExecute(hWndDlg, NULL, "http://www.mpeg4ip.net", NULL, NULL, SW_SHOW); break; case IDC_ID3: ShellExecute(hWndDlg, NULL, "http://id3lib.sourceforge.net", NULL, NULL, SW_SHOW); break; case IDC_EMAIL: ShellExecute(hWndDlg, NULL, "mailto:ntnfrn_email-temp@yahoo.it", NULL, NULL, SW_SHOW); break; } break; default: return FALSE; } return TRUE; } // ----------------------------------------------------------------------------------------------- // ripped from id3v2tag.c ID3GENRES ID3Genres[]= { 123, "Acapella", 34, "Acid", 74, "Acid Jazz", 73, "Acid Punk", 99, "Acoustic", 20, "Alternative", 40, "AlternRock", 26, "Ambient", 90, "Avantgarde", 116, "Ballad", 41, "Bass", 85, "Bebob", 96, "Big Band", 89, "Bluegrass", 0, "Blues", 107, "Booty Bass", 65, "Cabaret", 88, "Celtic", 104, "Chamber Music", 102, "Chanson", 97, "Chorus", 61, "Christian Rap", 1, "Classic Rock", 32, "Classical", 112, "Club", 57, "Comedy", 2, "Country", 58, "Cult", 3, "Dance", 125, "Dance Hall", 50, "Darkwave", 254, "Data", 22, "Death Metal", 4, "Disco", 55, "Dream", 122, "Drum Solo", 120, "Duet", 98, "Easy Listening", 52, "Electronic", 48, "Ethnic", 124, "Euro-House", 25, "Euro-Techno", 54, "Eurodance", 84, "Fast Fusion", 80, "Folk", 81, "Folk-Rock", 115, "Folklore", 119, "Freestyle", 5, "Funk", 30, "Fusion", 36, "Game", 59, "Gangsta", 38, "Gospel", 49, "Gothic", 91, "Gothic Rock", 6, "Grunge", 79, "Hard Rock", 7, "Hip-Hop", 35, "House", 100, "Humour", 19, "Industrial", 33, "Instrumental", 46, "Instrumental Pop", 47, "Instrumental Rock", 8, "Jazz", 29, "Jazz+Funk", 63, "Jungle", 86, "Latin", 71, "Lo-Fi", 45, "Meditative", 9, "Metal", 77, "Musical", 82, "National Folk", 64, "Native American", 10, "New Age", 66, "New Wave", 39, "Noise", 255, "Not Set", 11, "Oldies", 103, "Opera", 12, "Other", 75, "Polka", 13, "Pop", 62, "Pop/Funk", 53, "Pop-Folk", 109, "Porn Groove", 117, "Power Ballad", 23, "Pranks", 108, "Primus", 92, "Progressive Rock", 67, "Psychadelic", 93, "Psychedelic Rock", 43, "Punk", 121, "Punk Rock", 14, "R&B", 15, "Rap", 68, "Rave", 16, "Reggae", 76, "Retro", 87, "Revival", 118, "Rhythmic Soul", 17, "Rock", 78, "Rock & Roll", 114, "Samba", 110, "Satire", 69, "Showtunes", 21, "Ska", 111, "Slow Jam", 95, "Slow Rock", 105, "Sonata", 42, "Soul", 37, "Sound Clip", 24, "Soundtrack", 56, "Southern Rock", 44, "Space", 101, "Speech", 83, "Swing", 94, "Symphonic Rock", 106, "Symphony", 113, "Tango", 18, "Techno", 51, "Techno-Industrial", 60, "Top 40", 70, "Trailer", 31, "Trance", 72, "Tribal", 27, "Trip-Hop", 28, "Vocal" }; BOOL CALLBACK DIALOGMsgProcEnc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: { char buf[50]; char FillList=wParam||lParam ? 1 : 0; char *Quality[]={"Default (100)","10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","200","300","400","500",0}; char *BitRate[]={"Auto","8","16","18","20","24","32","40","48","56","64","80","96","112","128","160","192","224","256","320","384",0}; char *BandWidth[]={"Auto","Full","4000","8000","11025","16000","22050","24000","32000","44100","48000",0}; char *Ext[]={".aac",".mp4",".m4a",".m4b",0}; CMyEncCfg cfg(false); // sprintf(Quality[0]+8,"%3d",3); SetWindowPos(GetDlgItem(hWndDlg,IDC_CHK_TAG),GetDlgItem(hWndDlg,IDC_GRP_TAG),0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); INIT_CB(hWndDlg,IDC_CB_QUALITY,Quality,FillList,0); INIT_CB(hWndDlg,IDC_CB_BITRATE,BitRate,FillList,0); INIT_CB(hWndDlg,IDC_CB_BANDWIDTH,BandWidth,FillList,0); INIT_CB(hWndDlg,IDC_CB_EXT,Ext,FillList,0); INIT_CB_GENRES(hWndDlg,IDC_CB_GENRE,ID3Genres,0); SendMessage(GetDlgItem(hWndDlg, IDC_BTN_ARTFILE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse); #ifdef USE_OUTPUT_FOLDER SendMessage(GetDlgItem(hWndDlg, IDC_BTN_BROWSE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse); if(!cfg.OutDir || !*cfg.OutDir) { GetCurrentDirectory(MAX_PATH,config_AACoutdir); FREE_ARRAY(cfg.OutDir); cfg.OutDir=strdup(config_AACoutdir); } else strcpy(config_AACoutdir,cfg.OutDir); SetDlgItemText(hWndDlg, IDC_E_BROWSE, cfg.OutDir); #else ShowWindow(GetDlgItem(hWndDlg, IDC_BTN_BROWSE),SW_HIDE); ShowWindow(GetDlgItem(hWndDlg, IDC_E_BROWSE),SW_HIDE); ShowWindow(GetDlgItem(hWndDlg, IDC_L_BROWSE),SW_HIDE); #endif CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,FALSE); if(cfg.EncCfg.mpegVersion==MPEG4) CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE); else CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE); CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_SSR,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE); switch(cfg.EncCfg.aacObjectType) { case MAIN: CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); break; case LOW: CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE); break; case SSR: CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE); break; case LTP: CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE); DISABLE_LTP break; } CheckDlgButton(hWndDlg,IDC_RADIO_RAW,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,FALSE); switch(cfg.EncCfg.outputFormat) { case RAW: CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE); break; case ADTS: CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE); break; } CheckDlgButton(hWndDlg, IDC_CHK_ALLOWMIDSIDE, cfg.EncCfg.allowMidside); CheckDlgButton(hWndDlg, IDC_CHK_USETNS, cfg.EncCfg.useTns); CheckDlgButton(hWndDlg, IDC_CHK_USELFE, cfg.EncCfg.useLfe); if(cfg.UseQuality) CheckDlgButton(hWndDlg,IDC_RADIO_QUALITY,TRUE); else CheckDlgButton(hWndDlg,IDC_RADIO_BITRATE,TRUE); switch(cfg.EncCfg.quantqual) { case 100: SendMessage(GetDlgItem(hWndDlg, IDC_CB_QUALITY), CB_SETCURSEL, 0, 0); break; default: if(cfg.EncCfg.quantqual<10) cfg.EncCfg.quantqual=10; if(cfg.EncCfg.quantqual>500) cfg.EncCfg.quantqual=500; sprintf(buf,"%lu",cfg.EncCfg.quantqual); SetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf); break; } switch(cfg.EncCfg.bitRate) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, 0, 0); break; default: sprintf(buf,"%lu",cfg.EncCfg.bitRate); SetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf); break; } switch(cfg.EncCfg.bandWidth) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 0, 0); break; case 0xffffffff: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 1, 0); break; default: sprintf(buf,"%lu",cfg.EncCfg.bandWidth); SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf); break; } SendMessage(GetDlgItem(hWndDlg, IDC_CB_EXT), CB_SETCURSEL, cfg.SaveMP4, 0); if(wParam|lParam) { CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, cfg.AutoCfg); DISABLE_CTRLS_ENC(!cfg.AutoCfg); } #ifdef USE_IMPORT_TAG CheckDlgButton(hWndDlg,IDC_CHK_IMPORTTAG, cfg.TagImport); cfg.TagImport=IsDlgButtonChecked(hWndDlg,IDC_CHK_IMPORTTAG) ? 1 : 0; ShowWindow(GetDlgItem(hWndDlg, IDC_CHK_IMPORTTAG),SW_SHOW); #ifdef USE_PATHEXT SetDlgItemText(hWndDlg, IDC_E_SOURCEPATH, cfg.TagSrcPath); SetDlgItemText(hWndDlg, IDC_E_SOURCEEXT, cfg.TagSrcExt); SendMessage(GetDlgItem(hWndDlg, IDC_BTN_BROWSEIMPORT), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse); ShowWindow(GetDlgItem(hWndDlg, IDC_E_SOURCEEXT),SW_SHOW); ShowWindow(GetDlgItem(hWndDlg, IDC_E_SOURCEPATH),SW_SHOW); ShowWindow(GetDlgItem(hWndDlg, IDC_BTN_BROWSEIMPORT),SW_SHOW); #endif #endif CheckDlgButton(hWndDlg,IDC_CHK_TAG, cfg.TagOn); ENABLE_TAG(cfg.TagOn && !cfg.TagImport); ENABLE_AACTAGS(cfg.TagOn && !cfg.TagImport && cfg.SaveMP4); SetDlgItemText(hWndDlg, IDC_E_ARTIST, cfg.Tag.artist); SetDlgItemText(hWndDlg, IDC_E_TITLE, cfg.Tag.title); SetDlgItemText(hWndDlg, IDC_E_ALBUM, cfg.Tag.album); SetDlgItemText(hWndDlg, IDC_E_YEAR, cfg.Tag.year); SetDlgItemText(hWndDlg, IDC_CB_GENRE, cfg.Tag.genre); SetDlgItemText(hWndDlg, IDC_E_WRITER, cfg.Tag.writer); SetDlgItemText(hWndDlg, IDC_E_COMMENT, cfg.Tag.comment); SetDlgItemText(hWndDlg, IDC_E_ARTFILE, cfg.Tag.artFilename); SetDlgItemInt(hWndDlg, IDC_E_TRACK, cfg.Tag.trackno, FALSE); SetDlgItemInt(hWndDlg, IDC_E_NTRACKS, cfg.Tag.ntracks, FALSE); SetDlgItemInt(hWndDlg, IDC_E_DISK, cfg.Tag.discno, FALSE); SetDlgItemInt(hWndDlg, IDC_E_NDISKS, cfg.Tag.ndiscs, FALSE); SetDlgItemInt(hWndDlg, IDC_E_COMPILATION, cfg.Tag.compilation, FALSE); CheckDlgButton(hWndDlg, IDC_CHK_COMPILATION, cfg.Tag.compilation); } break; // End of WM_INITDIALOG case WM_CLOSE: // Closing the Dialog behaves the same as Cancel PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L); break; // End of WM_CLOSE case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: { // HANDLE hCfg=(HANDLE)lParam; char buf[50]; CMyEncCfg cfg; cfg.AutoCfg=IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG) ? TRUE : FALSE; if(!cfg.AutoCfg) { cfg.EncCfg.mpegVersion=IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4) ? MPEG4 : MPEG2; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN)) cfg.EncCfg.aacObjectType=MAIN; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW)) cfg.EncCfg.aacObjectType=LOW; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR)) cfg.EncCfg.aacObjectType=SSR; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP)) cfg.EncCfg.aacObjectType=LTP; cfg.EncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_CHK_ALLOWMIDSIDE); cfg.EncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_CHK_USETNS); cfg.EncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_CHK_USELFE); GetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf, 50); switch(*buf) { case 'A': // Auto cfg.EncCfg.bitRate=0; break; default: cfg.EncCfg.bitRate=GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE); } GetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf, 50); switch(*buf) { case 'A': // Auto cfg.EncCfg.bandWidth=0; break; case 'F': // Full cfg.EncCfg.bandWidth=0xffffffff; break; default: cfg.EncCfg.bandWidth=GetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, 0, FALSE); } cfg.UseQuality=IsDlgButtonChecked(hWndDlg,IDC_RADIO_QUALITY) ? TRUE : FALSE; GetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf, 50); switch(*buf) { case 'D': // Default cfg.EncCfg.quantqual=100; break; default: cfg.EncCfg.quantqual=GetDlgItemInt(hWndDlg, IDC_CB_QUALITY, 0, FALSE); } } cfg.EncCfg.outputFormat=IsDlgButtonChecked(hWndDlg,IDC_RADIO_RAW) ? RAW : ADTS; #ifdef USE_OUTPUT_FOLDER GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH); FREE_ARRAY(cfg.OutDir); cfg.OutDir=strdup(config_AACoutdir); #endif cfg.SaveMP4=(BYTE)SendMessage(GetDlgItem(hWndDlg, IDC_CB_EXT), CB_GETCURSEL, 0, 0); cfg.TagOn=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG) ? 1 : 0; char buffer[MAX_PATH]; #ifdef USE_IMPORT_TAG cfg.TagImport=IsDlgButtonChecked(hWndDlg,IDC_CHK_IMPORTTAG) ? 1 : 0; #ifdef USE_PATHEXT GetDlgItemText(hWndDlg, IDC_E_SOURCEPATH, buffer, MAX_PATH); cfg.TagSrcPath=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_SOURCEEXT, buffer, MAX_PATH); cfg.TagSrcExt=strdup(buffer); #endif #endif GetDlgItemText(hWndDlg, IDC_E_ARTIST, buffer, MAX_PATH); cfg.Tag.artist=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_TITLE, buffer, MAX_PATH); cfg.Tag.title=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_ALBUM, buffer, MAX_PATH); cfg.Tag.album=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_YEAR, buffer, MAX_PATH); cfg.Tag.year=strdup(buffer); GetDlgItemText(hWndDlg, IDC_CB_GENRE, buffer, MAX_PATH); cfg.Tag.genre=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_WRITER, buffer, MAX_PATH); cfg.Tag.writer=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_COMMENT, buffer, MAX_PATH); cfg.Tag.comment=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_ARTFILE, buffer, MAX_PATH); cfg.Tag.artFilename=strdup(buffer); cfg.Tag.trackno=GetDlgItemInt(hWndDlg, IDC_E_TRACK, 0, FALSE); cfg.Tag.ntracks=GetDlgItemInt(hWndDlg, IDC_E_NTRACKS, 0, FALSE); cfg.Tag.discno=GetDlgItemInt(hWndDlg, IDC_E_DISK, 0, FALSE); cfg.Tag.ndiscs=GetDlgItemInt(hWndDlg, IDC_E_NDISKS, 0, FALSE); cfg.Tag.compilation=(BYTE)GetDlgItemInt(hWndDlg, IDC_E_COMPILATION, 0, FALSE); cfg.Tag.compilation=IsDlgButtonChecked(hWndDlg, IDC_CHK_COMPILATION) ? 1 : 0; EndDialog(hWndDlg, TRUE);//(DWORD)hCfg); } break; case IDCANCEL: // Ignore data values entered into the controls // and dismiss the dialog window returning FALSE EndDialog(hWndDlg, FALSE); break; case IDC_BTN_ABOUT: DialogBox((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout); break; case IDC_BTN_LICENSE: { char *license = "\nPlease note that the use of this software may require the payment of patent royalties.\n" "You need to consider this issue before you start building derivative works.\n" "We are not warranting or indemnifying you in any way for patent royalities!\n" "YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!\n" "\n" "FAAC is based on the ISO MPEG-4 reference code. For this code base the\n" "following license applies:\n" "\n" /* "This software module was originally developed by\n" "\n" "FirstName LastName (CompanyName)\n" "\n" "and edited by\n" "\n" "FirstName LastName (CompanyName)\n" "FirstName LastName (CompanyName)\n" "\n" */ "in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard\n" "ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an\n" "implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools\n" "as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives\n" "users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this\n" "software module or modifications thereof for use in hardware or\n" "software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio\n" "standards. Those intending to use this software module in hardware or\n" "software products are advised that this use may infringe existing\n" "patents. The original developer of this software module and his/her\n" "company, the subsequent editors and their companies, and ISO/IEC have\n" "no liability for use of this software module or modifications thereof\n" "in an implementation. Copyright is not released for non MPEG-2\n" "NBC/MPEG-4 Audio conforming products. The original developer retains\n" "full right to use the code for his/her own purpose, assign or donate\n" "the code to a third party and to inhibit third party from using the\n" "code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This\n" "copyright notice must be included in all copies or derivative works.\n" "\n" "Copyright (c) 1997.\n" "\n" "For the changes made for the FAAC project the GNU Lesser General Public\n" "License (LGPL), version 2 1991 applies:\n" "\n" "FAAC - Freeware Advanced Audio Coder\n" "Copyright (C) 2001-2004 The individual contributors\n" "\n" "This library is free software; you can redistribute it and/or modify it under the terms of\n" "the GNU Lesser General Public License as published by the Free Software Foundation;\n" "either version 2.1 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n" "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "See the GNU Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; MessageBox(hWndDlg,license,"FAAC libray License",MB_OK|MB_ICONINFORMATION); } break; #ifdef USE_OUTPUT_FOLDER case IDC_BTN_BROWSE: { BROWSEINFO bi; ITEMIDLIST *idlist; GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH); bi.hwndOwner = hWndDlg; bi.pidlRoot = 0; bi.pszDisplayName = config_AACoutdir; bi.lpszTitle = "Select a directory for aac/mp4 file output:"; bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lpfn = BrowseCallbackProc; bi.lParam = (LPARAM)config_AACoutdir; idlist = SHBrowseForFolder(&bi); if(idlist) { SHGetPathFromIDList(idlist, config_AACoutdir); SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir); } } break; #endif case IDC_BTN_ARTFILE: { OPENFILENAME ofn; char ArtFilename[MAX_PATH]=""; GetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename, MAX_PATH); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = (HWND)hWndDlg; ofn.lpstrFilter = "Cover art files (*.gif,*jpg,*.png)\0*.gif;*.jpg;*.png\0"; ofn.lpstrCustomFilter = NULL; ofn.nFilterIndex = 1; ofn.lpstrFile = ArtFilename; ofn.nMaxFile = MAX_PATH; //sizeof ArtFilename; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = "Select cover art file"; ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING; ofn.lpstrDefExt = NULL;//"jpg"; ofn.hInstance = hInstance; if(GetOpenFileName(&ofn)) SetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename); } break; #ifdef USE_IMPORT_TAG case IDC_BTN_BROWSEIMPORT: { char path[MAX_PATH]; BROWSEINFO bi; ITEMIDLIST *idlist; GetDlgItemText(hWndDlg, IDC_E_SOURCEPATH, path, MAX_PATH); bi.hwndOwner = hWndDlg; bi.pidlRoot = 0; bi.pszDisplayName = path; bi.lpszTitle = "Select the folder where source files are stored:"; bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lpfn = BrowseCallbackProc; bi.lParam = (LPARAM)path; idlist=SHBrowseForFolder(&bi); if(idlist) { SHGetPathFromIDList(idlist, path); SetDlgItemText(hWndDlg, IDC_E_SOURCEPATH, path); } } break; #endif case IDC_RADIO_MPEG4: EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG)); break; case IDC_RADIO_MPEG2: EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE); DISABLE_LTP break; case IDC_CHK_AUTOCFG: { BYTE Enabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG); DISABLE_CTRLS_ENC(!Enabled); if(!Enabled) SendMessage(hWndDlg, WM_INITDIALOG, 0L, 0L); else { SetDlgItemInt(hWndDlg, IDC_CB_QUALITY, DEF_QUALITY, FALSE); SetDlgItemInt(hWndDlg, IDC_CB_BITRATE, DEF_BITRATE, FALSE); SetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, DEF_BANDWIDTH, FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,FALSE); if(DEF_MPEGVER==MPEG4) CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE); else CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE); CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_SSR,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE); switch(DEF_PROFILE) { case MAIN: CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); break; case LOW: CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE); break; case SSR: CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE); break; case LTP: CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE); DISABLE_LTP break; } CheckDlgButton(hWndDlg,IDC_RADIO_RAW,FALSE); CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,FALSE); switch(DEF_HEADER) { case RAW: CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE); break; case ADTS: CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE); break; } CheckDlgButton(hWndDlg, IDC_CHK_ALLOWMIDSIDE, DEF_MIDSIDE); CheckDlgButton(hWndDlg, IDC_CHK_USETNS, DEF_TNS); CheckDlgButton(hWndDlg, IDC_CHK_USELFE, DEF_LFE); if(DEF_USEQUALTY) CheckDlgButton(hWndDlg,IDC_RADIO_QUALITY,true); else CheckDlgButton(hWndDlg,IDC_RADIO_BITRATE,true); if(DEF_QUALITY<10) SetDlgItemInt(hWndDlg, IDC_CB_QUALITY, 10, FALSE); else if(DEF_QUALITY>500) SetDlgItemInt(hWndDlg, IDC_CB_QUALITY, 500, FALSE); else SetDlgItemInt(hWndDlg, IDC_CB_QUALITY, DEF_QUALITY, FALSE); switch(DEF_BITRATE) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, 0, 0); // SetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 128, FALSE); break; default: SetDlgItemInt(hWndDlg, IDC_CB_BITRATE, DEF_BITRATE, FALSE); break; } switch(DEF_BANDWIDTH) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 0, 0); break; case 0xffffffff: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 1, 0); break; default: SetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, DEF_BANDWIDTH, FALSE); break; } SendMessage(GetDlgItem(hWndDlg, IDC_CB_EXT), CB_SETCURSEL, DEF_WRITEMP4, 0); // DISABLE_CTRLS_ENC(!Enabled); } } break; case IDC_CHK_TAG: case IDC_CB_EXT: { char TagImport=IsDlgButtonChecked(hWndDlg,IDC_CHK_IMPORTTAG); char TagEnabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG); ENABLE_TAG(TagEnabled && !TagImport); char Enabled=SendMessage(GetDlgItem(hWndDlg, IDC_CB_EXT), CB_GETCURSEL, 0, 0)!=0; ENABLE_AACTAGS(TagEnabled && !TagImport && Enabled); } break; #ifdef USE_IMPORT_TAG case IDC_CHK_IMPORTTAG: SendMessage(hWndDlg, WM_COMMAND, IDC_CHK_TAG, 0); break; #endif } break; // End of WM_COMMAND default: return FALSE; } return TRUE; } // End of DIALOGSMsgProc faac-1.28/common/Cfaac/EncDialog.h0000644010307701030770000000027310141510627020326 0ustar fabian-guestfabian-guestextern BOOL DialogMsgProcAbout(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam); extern BOOL CALLBACK DIALOGMsgProcEnc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam); faac-1.28/common/Cfaac/FAAC.rc0000644010307701030770000002747410142153674017372 0ustar fabian-guestfabian-guest// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_ENCODER DIALOGEX 0, 0, 338, 219 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "MPEG4-AAC options" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "&OK",IDOK,12,200,36,14 PUSHBUTTON "&Cancel",IDCANCEL,48,200,36,14 PUSHBUTTON "&About",IDC_BTN_ABOUT,84,200,36,14 PUSHBUTTON "&License",IDC_BTN_LICENSE,120,200,36,14 CONTROL "Automatic configuration",IDC_CHK_AUTOCFG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,4,90,10 CONTROL "Main",IDC_RADIO_MAIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,28,31,10 CONTROL "LC",IDC_RADIO_LOW,"Button",BS_AUTORADIOBUTTON,9,40,25, 10 CONTROL "LTP",IDC_RADIO_LTP,"Button",BS_AUTORADIOBUTTON,9,52,29, 10 CONTROL "SSR",IDC_RADIO_SSR,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED,9,63,31,10 CONTROL "MPEG4",IDC_RADIO_MPEG4,"Button",BS_AUTORADIOBUTTON | WS_GROUP,62,27,40,10 CONTROL "MPEG2",IDC_RADIO_MPEG2,"Button",BS_AUTORADIOBUTTON,62, 40,40,9 CONTROL "Raw",IDC_RADIO_RAW,"Button",BS_AUTORADIOBUTTON | WS_GROUP,112,27,42,10 CONTROL "ADTS",IDC_RADIO_ADTS,"Button",BS_AUTORADIOBUTTON,112,40, 41,9 CONTROL "Quality",IDC_RADIO_QUALITY,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,84,37,10 COMBOBOX IDC_CB_QUALITY,102,81,48,97,CBS_DROPDOWN | WS_VSCROLL | WS_GROUP | WS_TABSTOP CONTROL "Bitrate",IDC_RADIO_BITRATE,"Button",BS_AUTORADIOBUTTON, 9,100,36,10 COMBOBOX IDC_CB_BITRATE,102,97,48,86,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "Cutoff",IDC_STATIC,21,121,20,8 COMBOBOX IDC_CB_BANDWIDTH,102,118,48,81,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "Write",IDC_STATIC,22,138,18,8 COMBOBOX IDC_CB_EXT,102,135,48,81,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Allow Mid/Side",IDC_CHK_ALLOWMIDSIDE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,9,152,63,10 CONTROL "Use TNS",IDC_CHK_USETNS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,9,162,45,10 CONTROL "Use LFE channel",IDC_CHK_USELFE,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,88,152,67,10 EDITTEXT IDC_E_BROWSE,50,172,83,14,ES_AUTOHSCROLL PUSHBUTTON "Browse",IDC_BTN_BROWSE,137,172,18,14,BS_BITMAP | BS_FLAT GROUPBOX "",IDC_GRP_TAG,160,4,174,210 CONTROL "Tag",IDC_CHK_TAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 165,3,29,10 CONTROL "Import",IDC_CHK_IMPORTTAG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,165,15,35,10 EDITTEXT IDC_E_SOURCEPATH,207,11,63,14,ES_AUTOHSCROLL | NOT WS_VISIBLE PUSHBUTTON "Browse",IDC_BTN_BROWSEIMPORT,273,11,18,14,BS_BITMAP | BS_FLAT | NOT WS_VISIBLE EDITTEXT IDC_E_SOURCEEXT,294,11,34,14,ES_AUTOHSCROLL | NOT WS_VISIBLE EDITTEXT IDC_E_ARTIST,207,27,121,14,ES_AUTOHSCROLL EDITTEXT IDC_E_TITLE,207,42,121,14,ES_AUTOHSCROLL EDITTEXT IDC_E_ALBUM,207,57,121,14,ES_AUTOHSCROLL EDITTEXT IDC_E_YEAR,207,72,121,14,ES_AUTOHSCROLL COMBOBOX IDC_CB_GENRE,207,87,121,161,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_E_WRITER,207,101,121,14,ES_AUTOHSCROLL EDITTEXT IDC_E_COMMENT,207,116,121,29,ES_MULTILINE | ES_AUTOHSCROLL EDITTEXT IDC_E_COMPILATION,207,146,121,14,ES_AUTOHSCROLL | NOT WS_VISIBLE CONTROL "Part of a compilation",IDC_CHK_COMPILATION,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,165,148,80,10 EDITTEXT IDC_E_TRACK,233,162,40,14,ES_AUTOHSCROLL EDITTEXT IDC_E_NTRACKS,288,162,40,14,ES_AUTOHSCROLL EDITTEXT IDC_E_DISK,233,177,40,14,ES_AUTOHSCROLL EDITTEXT IDC_E_NDISKS,288,177,40,14,ES_AUTOHSCROLL EDITTEXT IDC_E_ARTFILE,207,192,98,14,ES_AUTOHSCROLL PUSHBUTTON "&...",IDC_BTN_ARTFILE,311,192,17,14,BS_BITMAP | BS_FLAT GROUPBOX "AAC type",IDC_STATIC,56,16,48,52 GROUPBOX "Profile",IDC_STATIC,4,16,48,52 GROUPBOX "Header",IDC_STATIC,108,16,48,52 GROUPBOX "Encoding mode",IDC_STATIC,4,73,152,42 LTEXT "Artist",IDC_STATIC,165,29,16,8 LTEXT "Title",IDC_STATIC,165,44,14,8 LTEXT "Album",IDC_STATIC,165,59,20,8 LTEXT "Year",IDC_STATIC,165,74,16,8 LTEXT "Genre",IDC_STATIC,165,89,20,8 LTEXT "Writer",IDC_STATIC,165,103,20,8 LTEXT "Comment\n(ctrl-Enter\nto go down)",IDC_STATIC,165,118, 37,26 LTEXT "Track",IDC_STATIC,165,166,20,8 LTEXT "/",IDC_STATIC,277,166,8,8 LTEXT "Disk",IDC_STATIC,165,180,15,8 LTEXT "/",IDC_STATIC,277,180,8,8 LTEXT "Cover art file",IDC_STATIC,165,195,40,8 LTEXT "Output folder",IDC_L_BROWSE,4,175,42,8 END IDD_DECODER DIALOGEX 0, 0, 162, 153 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Raw .AAC options" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "&OK",IDOK,47,132,36,14 PUSHBUTTON "&Cancel",IDCANCEL,83,132,36,14 PUSHBUTTON "&About",IDC_BTN_ABOUT,119,132,36,14 CONTROL "Main",IDC_RADIO_MAIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,19,33,31,10 CONTROL "Low",IDC_RADIO_LOW,"Button",BS_AUTORADIOBUTTON,19,44,29, 10 CONTROL "SSR",IDC_RADIO_SSR,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,56,31,10 CONTROL "LTP",IDC_RADIO_LTP,"Button",BS_AUTORADIOBUTTON,19,68,29, 10 GROUPBOX "Profile",IDC_STATIC,13,23,48,70 COMBOBOX IDC_CB_SAMPLERATE,72,74,69,87,CBS_DROPDOWN | WS_DISABLED | WS_VSCROLL | WS_TABSTOP CONTROL "Default settings",IDC_CHK_DEFAULTCFG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,7,64,10 GROUPBOX "Sample rate",IDC_STATIC,66,61,81,32 CONTROL "HE",IDC_RADIO_HE,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,80,26,10 CONTROL "Down matrix 5.1 to 2 channels",IDC_CHK_DOWNMATRIX, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,98,111,10 CONTROL "Assume old ADTS format",IDC_CHK_OLDADTS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,110,95,10 COMBOBOX IDC_CB_BITSPERSAMPLE,72,35,69,87,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP GROUPBOX "Output bits per sample",IDC_STATIC,66,23,81,32 GROUPBOX "",IDC_GRP_DEFAULT,7,8,147,118 END #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE BEGIN "resource.h\0" END 2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_ENCODER, DIALOG BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 334 TOPMARGIN, 4 BOTTOMMARGIN, 214 END IDD_DECODER, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 154 TOPMARGIN, 7 BOTTOMMARGIN, 146 END END #endif // APSTUDIO_INVOKED #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Italian (Italy) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA) #ifdef _WIN32 LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_ABOUT DIALOGEX 0, 0, 191, 230 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "About" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "&OK",IDOK,145,208,39,14 CONTROL 104,IDC_AUDIOCODING,"Static",SS_BITMAP | SS_NOTIFY | SS_SUNKEN,7,7,178,69 CONTROL 107,IDC_MPEG4IP,"Static",SS_BITMAP | SS_NOTIFY | SS_SUNKEN,7,202,59,20 CONTROL 106,IDC_EMAIL,"Static",SS_BITMAP | SS_NOTIFY,96,204,43, 18 LTEXT "Text",IDC_L_ABOUT,7,55,177,142 ICON IDI_ID3,IDC_ID3,70,202,20,20,SS_NOTIFY | SS_SUNKEN END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_ABOUT, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 184 TOPMARGIN, 7 BOTTOMMARGIN, 222 END END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_AUDIOCODING BITMAP "AudioCoding.bmp" IDB_EMAIL BITMAP "Email.bmp" IDB_MPEG4IP BITMAP "mpeg4ip-v.bmp" IDB_BROWSE BITMAP "Open.bmp" ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ID3 ICON "id3v2.ico" ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 1,3,0,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "041004b0" BEGIN VALUE "FileDescription", "CFAAC" VALUE "FileVersion", "1, 3, 0, 0" VALUE "InternalName", "FAAC" VALUE "LegalCopyright", "Copyright (C) 2004" VALUE "OriginalFilename", "FAAC.dll" VALUE "ProductName", " FAAC Dynamic Link Library" VALUE "ProductVersion", "1, 0, 0, 0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x410, 1200 END END #endif // Italian (Italy) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED faac-1.28/common/Cfaac/Open.bmp0000644010307701030770000000036610141510630017726 0ustar fabian-guestfabian-guestBMv(''ʦ wwwwwwUUUUUU'Ufffe'FFFCWdddRWQEFDF$WQ4WUUUUUUDWDDDDWAAWUUPQUPfaac-1.28/common/Cfaac/ReadMe.txt0000644010307701030770000000166610141510630020227 0ustar fabian-guestfabian-guest+----------------------------------------------------------------+ | | | Cfaac Readme | | ------------ | | | +----------------------------------------------------------------+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. ---------------------------------------------------------------------------- Cfaac is a set of classes to develop plugins (to import/export .aac/.mp4 files) with ease. ---------------------------------------------------------------------------- For suggestions, bugs report, etc., you can contact me at ntnfrn_email-temp@yahoo.it faac-1.28/common/Cfaac/TypeDef.h0000644010307701030770000000244410141510630020035 0ustar fabian-guestfabian-guest/* FAAC - codec plugin for Cooledit Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ //--------------------------------------------------------------------------- #ifndef TypeDefH #define TypeDefH //--------------------------------------------------------------------------- /* typedef.h */ #ifndef BYTE typedef unsigned char BYTE; #endif #ifndef WORD typedef unsigned short WORD; #endif #ifndef DWORD typedef unsigned long DWORD; #endif #ifndef QWORD typedef unsigned __int64 QWORD; #endif //--------------------------------------------------------------------------- #endif //--------------------------------------------------------------------------- faac-1.28/common/Cfaac/id3v2.ico0000644010307701030770000000137610141510630017752 0ustar fabian-guestfabian-guest ( @999ccc{{{cZPpP0P @P@A 0DP@ED @PE"TT1PTPBp@@  P   P? #1!9  !?faac-1.28/common/Cfaac/mpeg4ip-v.bmp0000644010307701030770000000634410141510630020637 0ustar fabian-guestfabian-guestBM :(V   cƻDzu4ͼ|A\Jwk˹ƩƬĥjQ|˾ex:{=Ĺr^az<¡}~DlWw7x:pRhNɶgĶfy<lȾ`µy;g{?VngGǵͿc^|@}Brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[P@Q[@r[ @rrrr@c @@  $r @rrr@ [r@ uuuu ruuuuurr: /..!P !!![rrr@P!!!!!!!/EQ!!/!/HcPrrrPH! Pg''`P g''' @rr] /.@$ @$!P !!![rrr@P!!!!!!!/[r!/!!!q!!BcPPPH!!rg''gP g''' @rrr !/r!! !/!P W!/!/[rrr@P!///!!Q!!/! /!/!Bcr r[H!/!@_'''gP g''F @rrrr !/:B!! !/!P W!/!/[rrr@P!//!7.!//!r !/!7 ////H[X'''gP g''F @rrrr !/c//!B !/!P W!/!/[rrr@P!// EPPZ !//!@!/!7!!!!////!!w'''gP g''F @rrrr //!!/[./!P !/!![rrr@P!!/ @Pr !/!!r!/!7!/!////!!w'''gP g''F @rrrr W!///!/.!/!P W!/!/[EPP@@P!//.EPPr !//!r!/!7$!!7.H!/!BX'''gP '''FrPPPr %6%lP % @@%%:r%%%?%%Z:0%%l58O2P e854p r@ l0600006600P 0000000:P000000]60000000?000?000l P58O2P e8882r 0000600P 000000P000000]6000%0crt?00l P58O2P e888O5 l000l00?0l00P l0000?000rt00000%]60000:ccr@0Q$000l P58O2P e8oOI HH$HH$P ?:6@.@rP[7H$ P5L^^K2P AL^LA 2L^Lz /!Hq$HB!!P !!!!!!7 !!! PaPr !!! 77B q7!! P_'''gP g''Fr_g'g- !///!!!////!P W!/!//!!7 !// EPPr !//!H!HPP!!7!/! P_'''gP '''Fr_''g- !///!/!////!P W!/!//!!7 !// @P@.!//! 7!/!7P[q!HH//! P_'''gP '''Fr_''g- !///!/c/////!P W!/!/!/! r!//!7. ]!//! H!/! PPr!////! P_'''gP g''Fuzg'gz !///! /!///!P W!///H///!///!!7r!!/! /// P@@@!////! P_'''gP g'''F'''g !!!r:/!!!!P !!!!!!/!!!!!7 r!/!!//H[PrrP!!!!! Pg''`P g'''g''gu /HHH/.@ /HHH/@ /HHHHHHPP/qHHHH/  /!!![@@rrP/HHH/ P_'FF'P A'FFFFFz4rr[[[@r[[[[@rQ[[[[[cr@@@[[[[[[Qr@  Prrrrrc[[[Qr@ruuuu r uuuuu rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfaac-1.28/common/Cfaac/resource.h0000644010307701030770000000642510141510630020327 0ustar fabian-guestfabian-guest//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by FAAC.rc // #define IDD_ENCODER 101 #define IDD_DECODER 102 #define IDD_ABOUT 103 #define IDB_AUDIOCODING 104 #define IDB_EMAIL 106 #define IDB_MPEG4IP 107 #define IDB_BROWSE 108 #define IDI_ID3 110 #define IDC_CHK_DEFAULTCFG 1000 #define IDC_CHK_DOWNMATRIX 1001 #define IDC_CHK_OLDADTS 1002 #define IDC_CB_SAMPLERATE 1003 #define IDC_AUDIOCODING 1004 #define IDC_CB_BITSPERSAMPLE 1004 #define IDC_EMAIL 1005 #define IDC_MPEG4IP 1006 #define IDC_E_BROWSE 1007 #define IDC_BTN_BROWSE 1008 #define IDC_RADIO_MPEG4 1009 #define IDC_RADIO_MPEG2 1010 #define IDC_RADIO_LOW 1011 #define IDC_RADIO_MAIN 1012 #define IDC_RADIO_SSR 1013 #define IDC_RADIO_LTP 1014 #define IDC_RADIO_RAW 1015 #define IDC_RADIO_HE 1016 #define IDC_BTN_BROWSE2 1016 #define IDC_BTN_BROWSEIMPORT 1016 #define IDC_RADIO_ADTS 1017 #define IDC_CB_BANDWIDTH 1018 #define IDC_CB_BITRATE 1019 #define IDC_CHK_ALLOWMIDSIDE 1020 #define IDC_CHK_USETNS 1021 #define IDC_CHK_USELFE 1022 #define IDC_CHK_AUTOCFG 1023 #define IDC_BTN_ABOUT 1024 #define IDC_L_ABOUT 1025 #define IDC_BTN_ARTFILE 1026 #define IDC_CHK_USETNS2 1027 #define IDC_CB_EXT 1028 #define IDC_RADIO_BITRATE 1030 #define IDC_RADIO_QUALITY 1031 #define IDC_CB_QUALITY 1032 #define IDC_E_ARTIST 1034 #define IDC_CHK_TAG 1035 #define IDC_E_TITLE 1036 #define IDC_E_ALBUM 1037 #define IDC_E_YEAR 1038 #define IDC_CB_GENRE 1039 #define IDC_E_WRITER 1040 #define IDC_E_COMMENT 1041 #define IDC_E_TRACK 1042 #define IDC_E_NTRACKS 1043 #define IDC_E_DISK 1044 #define IDC_E_NDISKS 1045 #define IDC_GRP_TAG 1046 #define IDC_E_COMPILATION 1047 #define IDC_E_ARTFILE 1048 #define IDC_BTN_LICENSE 1049 #define IDC_CHK_COMPILATION 1050 #define IDC_GRP_DEFAULT 1051 #define IDC_ID3 1052 #define IDC_L_BROWSE 1054 #define IDC_CHK_IMPORTTAG 1055 #define IDC_E_SOURCEEXT 1056 #define IDC_E_SOURCEPATH 1057 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 111 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1057 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif faac-1.28/common/Makefile.am0000644010307701030770000000006310101660515017362 0ustar fabian-guestfabian-guestif WITH_MP4V2 SUBDIRS = mp4v2 else SUBDIRS = endif faac-1.28/common/mp4v2/0000755010307701030770000000000011144236254016306 5ustar fabian-guestfabian-guestfaac-1.28/common/mp4v2/API_CHANGES0000644010307701030770000001052110101411050017746 0ustar fabian-guestfabian-guestChanges in xxxx --------------- Change to MP4Create and MP4Modify to allow flags to be set for 64 bit to allow Quicktime compatibility Change to MP4CloneTrack and MP4CopyTrack for when you copy a hint track - you must now specify the track ID in the new file for the reference track. Changes in 0.9.9 --------------------------- Added support for ISMA's Ismacrypt specification: MP4GetTrackEsdsObjectTypeId replaces MP4GetTrackAudioType and MP4GetTrackVideoType. MP4EncAndCloneTrack is used instead of MP4CloneTrack to encrypt a track while cloning it. MP4EncAndCopyTrack is used instead of MP4CopyTrack to encrypt a track while copying it. MP4AddEncAudioTrack adds an encrypted audio track. MP4AddEncVideoTrack adds an encrypted video track. Changes in 0.9.8 --------------------------- MP4WriteSample - changed "uint8_t * data" to "const uint8_t *data" Changes from 0.9.6 --------------------------- Modified MP4SetHintTrackRtpPayload payload parameter to get a dynamic payload is MP4_SET_DYNAMIC_PAYLOAD (value 0xff) instead of 0. Changes from 0.9.5 to 0.9.6 --------------------------- Modified MP4GetHintTrackRtpPayload MP4SetHintTrackRtpPayload get/set the encoding params (a=rtpmap /[/]) Changes from 0.9.4 to 0.9.5 --------------------------- Added MP4GetTrackAudioMpeg4Type() Returns MPEG-4 Audio type (e.g. AAC, CELP, HXVC, MIDI, etc.) MP4ReadSampleFromTime() Variant of MP4ReadSample() that uses time instead of sample id (basically MP4GetSampleIdFromTime() + MP4ReadSample()) MP4Info() MP4FileInfo() Returns summary info on tracks in file (from util/mp4info.cpp) The following functions add support for mp4 authoring/editting: MP4CloneTrack() Make a copy of a specified track, without media samples MP4CopyTrack() Make a copy of a specified track, with or without media samples MP4CopySample() Make a copy of a specified media sample MP4AddTrackEdit() Add a track edit list element MP4DeleteTrackEdit() Delete a track edit list element MP4GetTrackNumberOfEdits() Return the number of track edit list elements MP4GetTrackEditTotalDuration() Return the total duration of the track edit list MP4GetTrackEditStart() Return the edit start time for the edit list element MP4GetTrackEditMediaStart() Return the media start time for the edit list element MP4SetTrackEditMediaStart() Set the media start time for the edit list element MP4GetTrackEditDuration() Return the edit list element duration MP4SetTrackEditDuration() Set the edit list element duration MP4GetTrackEditDwell() Return the edit list element dwell parameter, see man page MP4SetTrackEditDwell() Set the edit list element dwell parameter, see man page MP4ReadSampleFromEditTime() Apply the edit list timeline to reading a sample MP4GetSampleIdFromEditTime() Return the sample id for a specified time on the edit list timeline Modified MP4GetSampleIdFromTime() Semantic change - now returns sample id corresponding to specified time, not the sample id with the smallest positive start time difference from the specified time. Changes from 0.9.3 to 0.9.4 --------------------------- Added MP4GetTrackVideoFrameRate() Returns video frame rate (average rate if video is variable rate). MP4GetTrackBitRate() Returns track average bit rate in bits-per-second. Changes from 0.9.2 to 0.9.3 --------------------------- Modified MP4Optimize() Second argument, newFileName, can now be NULL in which case a temporary file is created for the results of the optimization. Upon success, the existing file specified with the first argument is overwritten with the optimized file. MP4GetNumberOfTracks() MP4FindTrackId() Both have a new optional argument, subType, with default value 0. The subType can be specified for audio and video tracks to match only a specific encoding type. See man page for more details. Added MP4GetTrackVideoWidth() Returns video width in pixels. See man page for caveat. MP4GetTrackVideoHeight() Returns video height in pixels. See man page for caveat. faac-1.28/common/mp4v2/3gp.cpp0000644010307701030770000000761411136736372017522 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" #define _3GP_MAJOR_BRAND "3gp5" #define _3GP_MINOR_VERSION 0x0001 void MP4File::Make3GPCompliant(const char* fileName, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount, bool deleteIodsAtom) { char brand[5] = "3gp5"; char* _3gpSupportedBrands[1] = { (char*)&brand }; if (majorBrand) { if (!supportedBrands || !supportedBrandsCount) { throw new MP4Error("Invalid parameters", "MP4File::Make3GPCompliant"); } } MakeFtypAtom( majorBrand ? majorBrand : (char*)brand, majorBrand ? minorVersion : _3GP_MINOR_VERSION, majorBrand ? supportedBrands : (char**)_3gpSupportedBrands, majorBrand ? supportedBrandsCount : 1); if (deleteIodsAtom) { // Delete the iods atom, if it exists.... MP4Atom* iodsAtom = m_pRootAtom->FindAtom("moov.iods"); if (iodsAtom) { MP4Atom* moovAtom = m_pRootAtom->FindAtom("moov"); ASSERT(moovAtom); moovAtom->DeleteChildAtom(iodsAtom); } } } void MP4File::MakeFtypAtom(char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount) { bool rewriteNeeded = false; u_int32_t currentSupportedBrandsCount; u_int32_t i; MP4Atom* ftypAtom = m_pRootAtom->FindAtom("ftyp"); if (ftypAtom == NULL) { ftypAtom = InsertChildAtom(m_pRootAtom, "ftyp", 0); } if (majorBrand == NULL) return; MP4StringProperty* pMajorBrandProperty; if (!ftypAtom->FindProperty( "ftyp.majorBrand", (MP4Property**)&pMajorBrandProperty)) return; pMajorBrandProperty->SetValue(majorBrand); MP4Integer32Property* pMinorVersionProperty; if (!ftypAtom->FindProperty( "ftype.minorVersion", (MP4Property**)&pMinorVersionProperty)) return; pMinorVersionProperty->SetValue(minorVersion); MP4Integer32Property* pCompatibleBrandsCountProperty; if (!ftypAtom->FindProperty( "ftyp.compatibleBrandsCount", (MP4Property**)&pCompatibleBrandsCountProperty)) return; currentSupportedBrandsCount = pCompatibleBrandsCountProperty->GetValue(); MP4TableProperty* pCompatibleBrandsProperty; if (!ftypAtom->FindProperty( "ftyp.compatibleBrands", (MP4Property**)&pCompatibleBrandsProperty)) return; MP4StringProperty* pBrandProperty = (MP4StringProperty*) pCompatibleBrandsProperty->GetProperty(0); ASSERT(pBrandProperty); for (i = 0 ; i < ((currentSupportedBrandsCount > supportedBrandsCount) ? supportedBrandsCount : currentSupportedBrandsCount) ; i++) { pBrandProperty->SetValue(supportedBrands[i], i); } if (i < supportedBrandsCount) { for ( ; i < supportedBrandsCount ; i++) { pBrandProperty->AddValue(supportedBrands[i]); } } if (currentSupportedBrandsCount != supportedBrandsCount) { rewriteNeeded = true; pBrandProperty->SetCount(supportedBrandsCount); pCompatibleBrandsCountProperty->SetReadOnly(false); pCompatibleBrandsCountProperty->SetValue(supportedBrandsCount); pCompatibleBrandsCountProperty->SetReadOnly(true); } } faac-1.28/common/mp4v2/Makefile.in0000644010307701030770000005106211144236254020357 0ustar fabian-guestfabian-guest# 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 = common/mp4v2 DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mpeg4ip_config.h LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libmp4v2_a_AR = $(AR) $(ARFLAGS) libmp4v2_a_LIBADD = am_libmp4v2_a_OBJECTS = 3gp.$(OBJEXT) atom_amr.$(OBJEXT) \ atom_avc1.$(OBJEXT) atom_avcC.$(OBJEXT) atom_d263.$(OBJEXT) \ atom_damr.$(OBJEXT) atom_dref.$(OBJEXT) atom_elst.$(OBJEXT) \ atom_enca.$(OBJEXT) atom_encv.$(OBJEXT) atom_free.$(OBJEXT) \ atom_ftyp.$(OBJEXT) atom_gmin.$(OBJEXT) atom_hdlr.$(OBJEXT) \ atom_hinf.$(OBJEXT) atom_hnti.$(OBJEXT) atom_href.$(OBJEXT) \ atom_mdat.$(OBJEXT) atom_mdhd.$(OBJEXT) atom_meta.$(OBJEXT) \ atom_mp4s.$(OBJEXT) atom_mp4v.$(OBJEXT) atom_mvhd.$(OBJEXT) \ atom_ohdr.$(OBJEXT) atom_root.$(OBJEXT) atom_rtp.$(OBJEXT) \ atom_s263.$(OBJEXT) atom_sdp.$(OBJEXT) atom_smi.$(OBJEXT) \ atom_sound.$(OBJEXT) atom_standard.$(OBJEXT) \ atom_stbl.$(OBJEXT) atom_stdp.$(OBJEXT) atom_stsc.$(OBJEXT) \ atom_stsd.$(OBJEXT) atom_stsz.$(OBJEXT) atom_stz2.$(OBJEXT) \ atom_text.$(OBJEXT) atom_tfhd.$(OBJEXT) atom_tkhd.$(OBJEXT) \ atom_treftype.$(OBJEXT) atom_trun.$(OBJEXT) \ atom_udta.$(OBJEXT) atom_url.$(OBJEXT) atom_urn.$(OBJEXT) \ atom_video.$(OBJEXT) atom_vmhd.$(OBJEXT) descriptors.$(OBJEXT) \ isma.$(OBJEXT) mp4atom.$(OBJEXT) mp4container.$(OBJEXT) \ mp4.$(OBJEXT) mp4descriptor.$(OBJEXT) mp4file.$(OBJEXT) \ mp4file_io.$(OBJEXT) mp4info.$(OBJEXT) mp4meta.$(OBJEXT) \ mp4property.$(OBJEXT) mp4track.$(OBJEXT) mp4util.$(OBJEXT) \ ocidescriptors.$(OBJEXT) odcommands.$(OBJEXT) \ qosqualifiers.$(OBJEXT) rtphint.$(OBJEXT) virtual_io.$(OBJEXT) libmp4v2_a_OBJECTS = $(am_libmp4v2_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 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 = $(libmp4v2_a_SOURCES) DIST_SOURCES = $(libmp4v2_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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@ INCLUDES = -I$(top_srcdir)/include AM_CXXFLAGS = -Wall noinst_LIBRARIES = libmp4v2.a noinst_HEADERS = mp4.h mpeg4ip.h mpeg4ip_version.h mpeg4ip_config.h libmp4v2_a_SOURCES = \ 3gp.cpp \ atom_amr.cpp \ atom_avc1.cpp \ atom_avcC.cpp \ atom_d263.cpp \ atom_damr.cpp \ atom_dref.cpp \ atom_elst.cpp \ atom_enca.cpp \ atom_encv.cpp \ atom_free.cpp \ atom_ftyp.cpp \ atom_gmin.cpp \ atom_hdlr.cpp \ atom_hinf.cpp \ atom_hnti.cpp \ atom_href.cpp \ atom_mdat.cpp \ atom_mdhd.cpp \ atom_meta.cpp \ atom_mp4s.cpp \ atom_mp4v.cpp \ atom_mvhd.cpp \ atom_ohdr.cpp \ atom_root.cpp \ atom_rtp.cpp \ atom_s263.cpp \ atom_sdp.cpp \ atoms.h \ atom_smi.cpp \ atom_sound.cpp \ atom_standard.cpp \ atom_stbl.cpp \ atom_stdp.cpp \ atom_stsc.cpp \ atom_stsd.cpp \ atom_stsz.cpp \ atom_stz2.cpp \ atom_text.cpp \ atom_tfhd.cpp \ atom_tkhd.cpp \ atom_treftype.cpp \ atom_trun.cpp \ atom_udta.cpp \ atom_url.cpp \ atom_urn.cpp \ atom_video.cpp \ atom_vmhd.cpp \ descriptors.cpp \ descriptors.h \ isma.cpp \ mp4array.h \ mp4atom.cpp \ mp4atom.h \ mp4common.h \ mp4container.cpp \ mp4container.h \ mp4.cpp \ mp4descriptor.cpp \ mp4descriptor.h \ mp4file.cpp \ mp4file.h \ mp4file_io.cpp \ mp4info.cpp \ mp4meta.cpp \ mp4property.cpp \ mp4property.h \ mp4track.cpp \ mp4track.h \ mp4util.cpp \ mp4util.h \ ocidescriptors.cpp \ ocidescriptors.h \ odcommands.cpp \ odcommands.h \ qosqualifiers.cpp \ qosqualifiers.h \ rtphint.cpp \ rtphint.h \ virtual_io.cpp \ virtual_io.h EXTRA_DIST = API_CHANGES \ INTERNALS \ libmp4v260.dsp \ libmp4v2_st60.dsp \ TODO all: all-am .SUFFIXES: .SUFFIXES: .cpp .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) --gnu common/mp4v2/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu common/mp4v2/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-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmp4v2.a: $(libmp4v2_a_OBJECTS) $(libmp4v2_a_DEPENDENCIES) -rm -f libmp4v2.a $(libmp4v2_a_AR) libmp4v2.a $(libmp4v2_a_OBJECTS) $(libmp4v2_a_LIBADD) $(RANLIB) libmp4v2.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3gp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_amr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avc1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avcC.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_d263.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_damr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dref.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_elst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_enca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_encv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_free.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ftyp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_gmin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hdlr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hinf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hnti.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_href.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdhd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_meta.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4s.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mvhd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ohdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_root.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_rtp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_s263.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sdp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_smi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_standard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stbl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stdp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsz.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stz2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tfhd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tkhd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_treftype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trun.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_udta.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_url.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_urn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_video.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_vmhd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/descriptors.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isma.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4atom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4container.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4descriptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4meta.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4property.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4track.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocidescriptors.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odcommands.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qosqualifiers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtphint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual_io.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -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 $(LIBRARIES) $(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 clean-noinstLIBRARIES \ 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-noinstLIBRARIES 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: faac-1.28/common/mp4v2/INTERNALS0000644010307701030770000002407111136736372017603 0ustar fabian-guestfabian-guestJanuary 7, 2002 MP4V2 LIBRARY INTERNALS ======================= This document provides an overview of the internals of the mp4v2 library to aid those who wish to modify and extend it. Before reading this document, I recommend familiarizing yourself with the MP4 (or Quicktime) file format standard and the mp4v2 library API. The API is described in a set of man pages in mpeg4ip/doc/mp4v2, or if you prefer by looking at mp4.h. All the library code is written in C++, however the library API follows uses C calling conventions hence is linkable by both C and C++ programs. The library has been compiled and used on Linux, BSD, Windows, and Mac OS X. Other than libc, the library has no external dependencies, and hence can be used independently of the mpeg4ip package if desired. The library is used for both real-time recording and playback in mpeg4ip, and its runtime performance is up to those tasks. On the IA32 architecture compiled with gcc, the stripped library is approximately 600 KB code and initialized data. It is useful to think of the mp4v2 library as consisting of four layers: infrastructure, file format, generic tracks, and type specific track helpers. A description of each layer follows, from the fundamental to the optional. Infrastructure ============== The infrastructure layer provides basic file I/O, memory allocation, error handling, string utilities, and protected arrays. The source files for this layer are mp4file_io, mp4util, and mp4array. Note that the array classes uses preprocessor macros instead of C++ templates. The rationale for this is to increase portability given the sometimes incomplete support by some compilers for templates. File Format =========== The file format layer provides the translation from the on-disk MP4 file format to in-memory C++ structures and back to disk. It is intended to exactly match the MP4 specification in syntax and semantics. It represents the majority of the code. There are three key structures at the file format layer: atoms, properties, and descriptors. Atoms are the primary containers within an mp4 file. They can contain any combination of properties, other atoms, or descriptors. The mp4atom files contain the base class for all the atoms, and provide generic functions that cover most cases. Most atoms are covered in atom_standard.cpp. Atoms that have a special read, generation or write needs are contained in their subclass contained in file atom_.cpp, where is the four letter name of the atom defined in the MP4 specification. Atoms that only specifies the properties of the atom or the possible child atoms in the case of a container atom are located in atom_standard.cpp. In more specialized cases the atom specific file provides routines to initialize, read, or write the atom. Properties are the atomic pieces of information. The basic types of properties are integers, floats, strings, and byte arrays. For integers and floats there are subclasses that represent the different storage sizes, e.g. 8, 16, 24, 32, and 64 bit integers. For strings, there is 1 property class with a number of options regarding exact storage details, e.g. null terminated, fixed length, counted. For implementation reasons, there are also two special properties, table and descriptor, that are actually containers for groups of properties. I.e by making these containers provide a property interface much code can be written in a generic fashion. The mp4property files contain all the property related classes. Descriptors are containers that derive from the MPEG conventions and use different encoding rules than the atoms derived from the QuickTime file format. This means more use of bitfields and conditional existence with an emphasis on bit efficiency at the cost of encoding/decoding complexity. Descriptors can contain other descriptors and/or properties. The mp4descriptor files contain the generic base class for descriptors. Also the mp4property files have a descriptor wrapper class that allows a descriptor to behave as if it were a property. The specific descriptors are implemented as subclasses of the base class descriptor in manner similar to that of atoms. The descriptors, ocidescriptors, and qosqualifiers files contain these implementations. Each atom/property/descriptor has a name closely related to that in the MP4 specification. The difference being that the mp4v2 library doesn't use '-' or '_' in property names and capitalizes the first letter of each word, e.g. "thisIsAPropertyName". A complete name specifies the complete container path. The names follow the C/C++ syntax for elements and array indices. Examples are: "moov.mvhd.duration" "moov.trak[2].tkhd.duration" "moov.trak[3].minf.mdia.stbl.stsz[101].sampleSize" Note "*" can be used as a wildcard for an atom name (only). This is most useful when dealing with the stsd atom which contains child atoms with various names, but shared property names. Note that internally when performance matters the code looks up a property by name once, and then stores the returned pointer to the property class. To add an atom, first you should see if an existing atom exists that can be used. If not, you need to decide if special read/write or generate properties need to be established; for example a property in the atom changes other properties (adds, or subtracts). If there are no special cases, add the atom properties to atom_standard.cpp. If there are special properties, add a new file, add a new class to atoms.h, and add the class to MP4Atom::CreateAtom in mp4atom.cpp. Generic Tracks ============== The two entities at this level are the mp4 file as a whole and the tracks which are contained with it. The mp4file and mp4track files contain the implementation. The critical work done by this layer is to map the collection of atoms, properties, and descriptors that represent a media track into a useful, and consistent set of operations. For example, reading or writing a media sample of a track is a relatively simple operation from the library API perspective. However there are numerous pieces of information in the mp4 file that need to be properly used and updated to do this. This layer handles all those details. Given familiarity with the mp4 spec, the code should be straight-forward. What may not be immediately obvious are the functions to handle chunks of media samples. These exist to allow optimization of the mp4 file layout by reordering the chunks on disk to interleave the media sample chunks of multiple tracks in time order. (See MP4Optimize API doc). Type Specific Track Helpers =========================== This specialized code goes beyond the meta-information about tracks in the mp4 file to understanding and manipulating the information in the track samples. There are currently two helpers in the library: the MPEG-4 Systems Helper, and the RTP Hint Track Helper. The MPEG-4 Systems Helper is currently limited to creating the OD, BIFS, and SDP information about a minimal audio/video scene consistent with the Internet Streaming Media Alliance (ISMA) specifications. We will be evaluating how best to generalize the library's helper functions for MPEG-4 Systems without overburdening the implementation. The code for this helper is found in the isma and odcommands files. The RTP Hint Track Helper is more extensive in its support. The hint tracks contain the track packetization information needed to build RTP packets for streaming. The library can construct RTP packets based on the hint track making RTP based servers significantly easier to write. All code related to rtp hint tracks is in the rtphint files. It would also be useful to look at test/mp4broadcaster and mpeg4ip/server/mp4creator for examples of how this part of the library API can be used. Library API =========== The library API is defined and implemented in the mp4 files. The API uses C linkage conventions, and the mp4.h file adapts itself according to whether C or C++ is the compilation mode. All API calls are implemented in mp4.cpp and basically pass thru's to the MP4File member functions. This ensures that the library has internal access to the same functions as available via the API. All the calls in mp4.cpp use C++ try/catch blocks to protect against any runtime errors in the library. Upon error the library will print a diagnostic message if the verbostiy level has MP4_DETAILS_ERROR set, and return a distinguished error value, typically 0 or -1. The test and util subdirectories contain useful examples of how to use the library. Also the mp4creator and mp4live programs within mpeg4ip demonstrate more complete usage of the library API. Debugging ========= Since mp4 files are fairly complicated, extensive debugging support is built into the library. Multi-level diagnostic messages are available under the control of a verbosity bitmask described in the API. Also the library provides the MP4Dump() call which provides an ASCII version of the mp4 file meta-information. The mp4dump utilitity is a wrapper executable around this function. The mp4extract program is also provided in the utilities directory which is useful for extracting a track from an mp4file and putting the media data back into it's own file. It can also extract each sample of a track into its own file it that is desired. When all else fails, mp4 files are amenable to debugging by direct examination. Since the atom names are four letter ASCII codes finding reference points in a hex dump is feasible. On UNIX, the od command is your friend: "od -t x1z -A x [-j 0xXXXXXX] foo.mp4" will print a hex and ASCII dump, with hex addresses, starting optionally from a specified offset. The library diagnostic messages can provide information on where the library is reading or writing. General caveats =============== The coding convention is to use the C++ throw operator whenever an unrecoverable error occurs. This throw is caught at the API layer in mp4.cpp and translated into an error value. Be careful about indices. Internally, we follow the C/C++ convention to use zero-based indices. However the MP4 spec uses one-based indices for things like samples and hence the library API uses this convention. faac-1.28/common/mp4v2/Makefile.am0000644010307701030770000000311711136736372020353 0ustar fabian-guestfabian-guestINCLUDES = -I$(top_srcdir)/include AM_CXXFLAGS = -Wall noinst_LIBRARIES = libmp4v2.a noinst_HEADERS = mp4.h mpeg4ip.h mpeg4ip_version.h mpeg4ip_config.h libmp4v2_a_SOURCES = \ 3gp.cpp \ atom_amr.cpp \ atom_avc1.cpp \ atom_avcC.cpp \ atom_d263.cpp \ atom_damr.cpp \ atom_dref.cpp \ atom_elst.cpp \ atom_enca.cpp \ atom_encv.cpp \ atom_free.cpp \ atom_ftyp.cpp \ atom_gmin.cpp \ atom_hdlr.cpp \ atom_hinf.cpp \ atom_hnti.cpp \ atom_href.cpp \ atom_mdat.cpp \ atom_mdhd.cpp \ atom_meta.cpp \ atom_mp4s.cpp \ atom_mp4v.cpp \ atom_mvhd.cpp \ atom_ohdr.cpp \ atom_root.cpp \ atom_rtp.cpp \ atom_s263.cpp \ atom_sdp.cpp \ atoms.h \ atom_smi.cpp \ atom_sound.cpp \ atom_standard.cpp \ atom_stbl.cpp \ atom_stdp.cpp \ atom_stsc.cpp \ atom_stsd.cpp \ atom_stsz.cpp \ atom_stz2.cpp \ atom_text.cpp \ atom_tfhd.cpp \ atom_tkhd.cpp \ atom_treftype.cpp \ atom_trun.cpp \ atom_udta.cpp \ atom_url.cpp \ atom_urn.cpp \ atom_video.cpp \ atom_vmhd.cpp \ descriptors.cpp \ descriptors.h \ isma.cpp \ mp4array.h \ mp4atom.cpp \ mp4atom.h \ mp4common.h \ mp4container.cpp \ mp4container.h \ mp4.cpp \ mp4descriptor.cpp \ mp4descriptor.h \ mp4file.cpp \ mp4file.h \ mp4file_io.cpp \ mp4info.cpp \ mp4meta.cpp \ mp4property.cpp \ mp4property.h \ mp4track.cpp \ mp4track.h \ mp4util.cpp \ mp4util.h \ ocidescriptors.cpp \ ocidescriptors.h \ odcommands.cpp \ odcommands.h \ qosqualifiers.cpp \ qosqualifiers.h \ rtphint.cpp \ rtphint.h \ virtual_io.cpp \ virtual_io.h EXTRA_DIST = API_CHANGES \ INTERNALS \ libmp4v260.dsp \ libmp4v2_st60.dsp \ TODO faac-1.28/common/mp4v2/README0000644010307701030770000000162611136736372017202 0ustar fabian-guestfabian-guestJuly 18, 2002 MP4V2 Library ============= This library provides functions to read, create, and modify mp4 files. The detailed documentation of the library is available as a set of man pages in mpeg4ip/doc/mp4v2. The MP4.3 man page gives an overview of the library. Alternately mp4.h in this directory specifies the complete API. The file INTERNALS provides an overview of what is happening behind the API. Note that although we using C++ object oriented features internally, that's all hidden behind a flat C style API (with C linkage conventions). The test and util subdirectories contain some simple programs that use this library. Once make install is run, to use this library, you should: To use this library in your application, it should be sufficient to: 1) add the installed library to your final link: e.g. gcc ... -o foo foo.cpp -lmp4v2 2) include mp4.h into your code, e.g. #include faac-1.28/common/mp4v2/TODO0000644010307701030770000000032110101411050016747 0ustar fabian-guestfabian-guest Add ability to create samples referenced in multiple tracks Add ability to create atoms/properties via set or add operations Exploit extended format (ISO v2) List all possible atoms/properties with types faac-1.28/common/mp4v2/atom_amr.cpp0000644010307701030770000000352311136736372020623 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" MP4AmrAtom::MP4AmrAtom(const char *type) : MP4Atom(type) { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("timeScale")); AddReserved("reserved3", 2); /* 4 */ ExpectChildAtom("damr", Required, OnlyOne); } void MP4AmrAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved2 has non-zero fixed values static u_int8_t reserved2[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, }; m_pProperties[2]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[2])-> SetValue(reserved2, sizeof(reserved2)); m_pProperties[2]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_avc1.cpp0000644010307701030770000000427211136736372020700 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ #include "mp4common.h" MP4Avc1Atom::MP4Avc1Atom() : MP4Atom("avc1") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("width")); AddProperty( /* 4 */ new MP4Integer16Property("height")); AddReserved("reserved3", 14); /* 5 */ MP4StringProperty* pProp = new MP4StringProperty("compressorName"); pProp->SetFixedLength(32); pProp->SetValue("AVC Coding"); AddProperty(pProp); /* 6 */ AddReserved("reserved4", 4); /* 7 */ ExpectChildAtom("avcC", Required, OnlyOne); ExpectChildAtom("btrt", Optional, OnlyOne); // for now ExpectChildAtom("m4ds", Optional, OnlyOne); } void MP4Avc1Atom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved3 has non-zero fixed values static u_int8_t reserved3[14] = { 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, }; m_pProperties[5]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[5])-> SetValue(reserved3, sizeof(reserved3)); m_pProperties[5]->SetReadOnly(true); // property reserved4 has non-zero fixed values static u_int8_t reserved4[4] = { 0x00, 0x18, 0xFF, 0xFF, }; m_pProperties[7]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[7])-> SetValue(reserved4, sizeof(reserved4)); m_pProperties[7]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_avcC.cpp0000644010307701030770000001726611136736372020731 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ #include "mp4common.h" /* * SizeTableProperty is a special version of the MP4TableProperty - * the BytesProperty will need to set the value before it can read * from the file */ class SizeTableProperty : public MP4TableProperty { public: SizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) : MP4TableProperty(name, pCountProperty) {}; protected: void ReadEntry(MP4File *pFile, u_int32_t index) { // Each table has a size, followed by the length field // first, read the length m_pProperties[0]->Read(pFile, index); MP4IntegerProperty *pIntProp = (MP4IntegerProperty *)m_pProperties[0]; // set the size in the bytes property MP4BytesProperty *pBytesProp = (MP4BytesProperty *)m_pProperties[1]; pBytesProp->SetValueSize(pIntProp->GetValue(index), index); // And read the bytes m_pProperties[1]->Read(pFile, index); }; }; MP4AvcCAtom::MP4AvcCAtom() : MP4Atom("avcC") { MP4BitfieldProperty *pCount; MP4TableProperty *pTable; AddProperty( new MP4Integer8Property("configurationVersion")); /* 0 */ AddProperty( new MP4Integer8Property("AVCProfileIndication")); /* 1 */ AddProperty( new MP4Integer8Property("profile_compatibility")); /* 2 */ AddProperty( new MP4Integer8Property("AVCLevelIndication")); /* 3 */ AddProperty( new MP4BitfieldProperty("reserved", 6)); /* 4 */ AddProperty( new MP4BitfieldProperty("lengthSizeMinusOne", 2)); /* 5 */ AddProperty( new MP4BitfieldProperty("reserved1", 3)); /* 6 */ pCount = new MP4BitfieldProperty("numOfSequenceParameterSets", 5); AddProperty(pCount); /* 7 */ pTable = new SizeTableProperty("sequenceEntries", pCount); AddProperty(pTable); /* 8 */ pTable->AddProperty(new MP4Integer16Property("sequenceParameterSetLength")); pTable->AddProperty(new MP4BytesProperty("sequenceParameterSetNALUnit")); MP4Integer8Property *pCount2 = new MP4Integer8Property("numOfPictureParameterSets"); AddProperty(pCount2); /* 9 */ pTable = new SizeTableProperty("pictureEntries", pCount2); AddProperty(pTable); /* 10 */ pTable->AddProperty(new MP4Integer16Property("pictureParameterSetLength")); pTable->AddProperty(new MP4BytesProperty("pictureParameterSetNALUnit")); } void MP4AvcCAtom::Generate() { MP4Atom::Generate(); ((MP4Integer8Property*)m_pProperties[0])->SetValue(1); m_pProperties[4]->SetReadOnly(false); ((MP4BitfieldProperty*)m_pProperties[4])->SetValue(0x3f); m_pProperties[4]->SetReadOnly(true); m_pProperties[6]->SetReadOnly(false); ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0x7); m_pProperties[6]->SetReadOnly(true); #if 0 // property reserved4 has non-zero fixed values static u_int8_t reserved4[4] = { 0x00, 0x18, 0xFF, 0xFF, }; m_pProperties[7]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[7])-> SetValue(reserved4, sizeof(reserved4)); m_pProperties[7]->SetReadOnly(true); #endif } // // Clone - clone my properties to destination atom // // this method simplifies duplicating avcC atom properties from // source to destination file using a single API rather than // having to copy each property. This API encapsulates the object // so the application layer need not concern with each property // thereby isolating any future changes to atom properties. // // ---------------------------------------- // property description // ---------------------------------------- // // 0 configurationVersion // 1 AVCProfileIndication // 2 profile_compatibility // 3 AVCLevelIndication // 4 reserved // 5 lengthSizeMinusOne // 6 reserved // 7 number of SPS // 8 SPS entries // 9 number of PPS // 10 PPS entries // // void MP4AvcCAtom::Clone(MP4AvcCAtom *dstAtom) { MP4Property *dstProperty; MP4TableProperty *pTable; u_int16_t i16; u_int64_t i32; u_int64_t i64; u_int8_t *tmp; // source pointer Property I16 MP4Integer16Property *spPI16; // source pointer Property Bytes MP4BytesProperty *spPB; // dest pointer Property I16 MP4Integer16Property *dpPI16; // dest pointer Property Bytes MP4BytesProperty *dpPB; // start with defaults and reserved fields dstAtom->Generate(); // 0, 4, 6 are now generated from defaults // leaving 1, 2, 3, 5, 7, 8, 9, 10 to export dstProperty=dstAtom->GetProperty(1); ((MP4Integer8Property *)dstProperty)->SetValue( ((MP4Integer8Property *)m_pProperties[1])->GetValue()); dstProperty=dstAtom->GetProperty(2); ((MP4Integer8Property *)dstProperty)->SetValue( ((MP4Integer8Property *)m_pProperties[2])->GetValue()); dstProperty=dstAtom->GetProperty(3); ((MP4Integer8Property *)dstProperty)->SetValue( ((MP4Integer8Property *)m_pProperties[3])->GetValue()); dstProperty=dstAtom->GetProperty(5); ((MP4BitfieldProperty *)dstProperty)->SetValue( ((MP4BitfieldProperty *)m_pProperties[5])->GetValue()); // // 7 and 8 are related SPS (one set of sequence parameters) // // first the count bitfield // dstProperty=dstAtom->GetProperty(7); dstProperty->SetReadOnly(false); ((MP4BitfieldProperty *)dstProperty)->SetValue( ((MP4BitfieldProperty *)m_pProperties[7])->GetValue()); dstProperty->SetReadOnly(true); // next export SPS Length and NAL bytes */ // first source pointers pTable = (MP4TableProperty *) m_pProperties[8]; spPI16 = (MP4Integer16Property *)pTable->GetProperty(0); spPB = (MP4BytesProperty *)pTable->GetProperty(1); // now dest pointers dstProperty=dstAtom->GetProperty(8); pTable = (MP4TableProperty *) dstProperty; dpPI16 = (MP4Integer16Property *)pTable->GetProperty(0); dpPB = (MP4BytesProperty *)pTable->GetProperty(1); // sps length i16 = spPI16->GetValue(); i64 = i16; // FIXME - this leaves m_maxNumElements =2 // but src atom m_maxNumElements is 1 dpPI16->InsertValue(i64, 0); // export byte array i32 = i16; // copy bytes to local buffer tmp = (u_int8_t *)MP4Malloc(i32); ASSERT(tmp != NULL); spPB->CopyValue(tmp, 0); // set element count dpPB->SetCount(1); // copy bytes dpPB->SetValue(tmp, i32, 0); MP4Free((void *)tmp); // // 9 and 10 are related PPS (one set of picture parameters) // // first the integer8 count // dstProperty=dstAtom->GetProperty(9); dstProperty->SetReadOnly(false); ((MP4Integer8Property *)dstProperty)->SetValue( ((MP4Integer8Property *)m_pProperties[9])->GetValue()); dstProperty->SetReadOnly(true); // next export PPS Length and NAL bytes */ // first source pointers pTable = (MP4TableProperty *) m_pProperties[10]; spPI16 = (MP4Integer16Property *)pTable->GetProperty(0); spPB = (MP4BytesProperty *)pTable->GetProperty(1); // now dest pointers dstProperty=dstAtom->GetProperty(10); pTable = (MP4TableProperty *) dstProperty; dpPI16 = (MP4Integer16Property *)pTable->GetProperty(0); dpPB = (MP4BytesProperty *)pTable->GetProperty(1); // pps length i16 = spPI16->GetValue(); i64 = i16; dpPI16->InsertValue(i64, 0); // export byte array i32 = i16; // copy bytes to local buffer tmp = (u_int8_t *)MP4Malloc(i32); ASSERT(tmp != NULL); spPB->CopyValue(tmp, 0); // set element count dpPB->SetCount(1); // copy bytes dpPB->SetValue(tmp, i32, 0); MP4Free((void *)tmp); } faac-1.28/common/mp4v2/atom_d263.cpp0000644010307701030770000000427610101411050020476 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" #define H263_VENDOR 0x6d346970 MP4D263Atom::MP4D263Atom() : MP4Atom("d263") { AddProperty( /* 0 */ new MP4Integer32Property("vendor")); AddProperty( /* 1 */ new MP4Integer8Property("decoderVersion")); AddProperty( /* 2 */ new MP4Integer8Property("h263Level")); AddProperty( /* 3 */ new MP4Integer8Property("h263Profile")); ExpectChildAtom("bitr", Optional, OnlyOne); } void MP4D263Atom::Generate() { MP4Atom::Generate(); ((MP4Integer32Property*)m_pProperties[0])->SetValue(H263_VENDOR); ((MP4Integer8Property*)m_pProperties[1])->SetValue(1); } void MP4D263Atom::Write() { // Check whether we have valid values in the bitr atom // (if it exists, of course) MP4Atom* bitrAtom = FindAtom("d263.bitr"); if (bitrAtom) { u_int32_t avgBitrate; u_int32_t maxBitrate; MP4Integer32Property* pProp; bitrAtom->FindProperty("bitr.avgBitrate", (MP4Property**)&pProp, NULL); ASSERT(pProp); avgBitrate = pProp->GetValue(); bitrAtom->FindProperty("bitr.maxBitrate", (MP4Property**)&pProp, NULL); ASSERT(pProp); maxBitrate = pProp->GetValue(); if(!maxBitrate && !avgBitrate) { DeleteChildAtom(bitrAtom); } } MP4Atom::Write(); } faac-1.28/common/mp4v2/atom_damr.cpp0000644010307701030770000000316210101411050020734 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" #define AMR_VENDOR 0x6d346970 MP4DamrAtom::MP4DamrAtom() : MP4Atom("damr") { AddProperty( /* 0 */ new MP4Integer32Property("vendor")); AddProperty( /* 1 */ new MP4Integer8Property("decoderVersion")); AddProperty( /* 2 */ new MP4Integer16Property("modeSet")); AddProperty( /* 3 */ new MP4Integer8Property("modeChangePeriod")); AddProperty( /* 4 */ new MP4Integer8Property("framesPerSample")); } void MP4DamrAtom::Generate() { MP4Atom::Generate(); ((MP4Integer32Property*)m_pProperties[0])->SetValue(AMR_VENDOR); ((MP4Integer8Property*)m_pProperties[1])->SetValue(1); } faac-1.28/common/mp4v2/atom_dref.cpp0000644010307701030770000000306611136736372020766 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4DrefAtom::MP4DrefAtom() : MP4Atom("dref") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetReadOnly(); AddProperty(pCount); ExpectChildAtom("url ", Optional, Many); ExpectChildAtom("urn ", Optional, Many); ExpectChildAtom("alis", Optional, Many); } void MP4DrefAtom::Read() { /* do the usual read */ MP4Atom::Read(); // check that number of children == entryCount MP4Integer32Property* pCount = (MP4Integer32Property*)m_pProperties[2]; if (m_pChildAtoms.Size() != pCount->GetValue()) { VERBOSE_READ(GetVerbosity(), MP4Printf("Warning: dref inconsistency with number of entries")); /* fix it */ pCount->SetReadOnly(false); pCount->SetValue(m_pChildAtoms.Size()); pCount->SetReadOnly(true); } } faac-1.28/common/mp4v2/atom_elst.cpp0000644010307701030770000000371410101411050020763 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4ElstAtom::MP4ElstAtom() : MP4Atom("elst") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); } void MP4ElstAtom::AddProperties(u_int8_t version) { MP4TableProperty* pTable = (MP4TableProperty*)m_pProperties[3]; if (version == 1) { pTable->AddProperty( new MP4Integer64Property("segmentDuration")); pTable->AddProperty( new MP4Integer64Property("mediaTime")); } else { pTable->AddProperty( new MP4Integer32Property("segmentDuration")); pTable->AddProperty( new MP4Integer32Property("mediaTime")); } pTable->AddProperty( new MP4Integer16Property("mediaRate")); pTable->AddProperty( new MP4Integer16Property("reserved")); } void MP4ElstAtom::Generate() { SetVersion(0); AddProperties(GetVersion()); MP4Atom::Generate(); } void MP4ElstAtom::Read() { /* read atom version */ ReadProperties(0, 1); /* need to create the properties based on the atom version */ AddProperties(GetVersion()); /* now we can read the remaining properties */ ReadProperties(1); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_enca.cpp0000644010307701030770000000325510101411050020722 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com */ #include "mp4common.h" MP4EncaAtom::MP4EncaAtom() : MP4Atom("enca") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("timeScale")); AddReserved("reserved3", 2); /* 4 */ ExpectChildAtom("esds", Required, OnlyOne); ExpectChildAtom("sinf", Required, OnlyOne); } void MP4EncaAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved2 has non-zero fixed values static u_int8_t reserved2[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, }; m_pProperties[2]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[2])-> SetValue(reserved2, sizeof(reserved2)); m_pProperties[2]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_encv.cpp0000644010307701030770000000433211136736372020776 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com */ #include "mp4common.h" MP4EncvAtom::MP4EncvAtom() : MP4Atom("encv") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("width")); AddProperty( /* 4 */ new MP4Integer16Property("height")); AddReserved("reserved3", 14); /* 5 */ MP4StringProperty* pProp = new MP4StringProperty("compressorName"); pProp->SetFixedLength(32); pProp->SetValue(""); AddProperty(pProp); /* 6 */ AddReserved("reserved4", 4); /* 7 */ ExpectChildAtom("esds", Required, OnlyOne); ExpectChildAtom("sinf", Required, OnlyOne); ExpectChildAtom("avcC", Optional, OnlyOne); } void MP4EncvAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved3 has non-zero fixed values static u_int8_t reserved3[14] = { 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, }; m_pProperties[5]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[5])-> SetValue(reserved3, sizeof(reserved3)); m_pProperties[5]->SetReadOnly(true); // property reserved4 has non-zero fixed values static u_int8_t reserved4[4] = { 0x00, 0x18, 0xFF, 0xFF, }; m_pProperties[7]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[7])-> SetValue(reserved4, sizeof(reserved4)); m_pProperties[7]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_free.cpp0000644010307701030770000000223511136736372020764 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4FreeAtom::MP4FreeAtom() : MP4Atom("free") { } void MP4FreeAtom::Read() { Skip(); } void MP4FreeAtom::Write() { ASSERT(m_pFile); bool use64 = (GetSize() > (0xFFFFFFFF - 8)); BeginWrite(use64); #if 1 for (uint64_t ix = 0; ix < GetSize(); ix++) { m_pFile->WriteUInt8(0); } #else m_pFile->SetPosition(m_pFile->GetPosition() + GetSize()); #endif FinishWrite(use64); } faac-1.28/common/mp4v2/atom_ftyp.cpp0000644010307701030770000000412510101411050020773 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4FtypAtom::MP4FtypAtom() : MP4Atom("ftyp") { MP4StringProperty* pProp = new MP4StringProperty("majorBrand"); pProp->SetFixedLength(4); AddProperty(pProp); /* 0 */ AddProperty( /* 1 */ new MP4Integer32Property("minorVersion")); MP4Integer32Property* pCount = new MP4Integer32Property("compatibleBrandsCount"); pCount->SetImplicit(); AddProperty(pCount); /* 2 */ MP4TableProperty* pTable = new MP4TableProperty("compatibleBrands", pCount); AddProperty(pTable); /* 3 */ pProp = new MP4StringProperty("brand"); pProp->SetFixedLength(4); pTable->AddProperty(pProp); } void MP4FtypAtom::Generate() { MP4Atom::Generate(); ((MP4StringProperty*)m_pProperties[0])->SetValue("mp42"); MP4StringProperty* pBrandProperty = (MP4StringProperty*) ((MP4TableProperty*)m_pProperties[3])->GetProperty(0); ASSERT(pBrandProperty); pBrandProperty->AddValue("mp42"); pBrandProperty->AddValue("isom"); ((MP4Integer32Property*)m_pProperties[2])->IncrementValue(); ((MP4Integer32Property*)m_pProperties[2])->IncrementValue(); } void MP4FtypAtom::Read() { // table entry count computed from atom size ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false); ((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 8) / 4); ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true); MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_gmin.cpp0000644010307701030770000000271511136736372021000 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * Contributer has declined to give copyright information, and gives * it freely to the world. * * Contributor(s): */ #include "mp4common.h" MP4GminAtom::MP4GminAtom() : MP4Atom("gmin") { AddVersionAndFlags(); /* 0, 1 */ AddProperty(new MP4Integer16Property("graphicsMode")); /* 2 */ AddProperty(new MP4Integer16Property("opColorRed")); /* 3 */ AddProperty(new MP4Integer16Property("opColorGreen")); /* 4 */ AddProperty(new MP4Integer16Property("opColorBlue")); /* 5 */ AddProperty(new MP4Integer16Property("balance")); /* 6 */ AddReserved("reserved", 2); /* 7 */ } void MP4GminAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[2])->SetValue(0x0040); ((MP4Integer16Property*)m_pProperties[3])->SetValue(0x8000); ((MP4Integer16Property*)m_pProperties[4])->SetValue(0x8000); ((MP4Integer16Property*)m_pProperties[5])->SetValue(0x8000); ((MP4Integer16Property*)m_pProperties[6])->SetValue(0x0000); } faac-1.28/common/mp4v2/atom_hdlr.cpp0000644010307701030770000000370511136736372020777 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4HdlrAtom::MP4HdlrAtom() : MP4Atom("hdlr") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved1", 4); /* 2 */ MP4StringProperty* pProp = new MP4StringProperty("handlerType"); pProp->SetFixedLength(4); AddProperty(pProp); /* 3 */ AddReserved("reserved2", 12); /* 4 */ AddProperty( /* 5 */ new MP4StringProperty("name")); } // There is a spec incompatiblity between QT and MP4 // QT says name field is a counted string // MP4 says name field is a null terminated string // Here we attempt to make all things work void MP4HdlrAtom::Read() { // read all the properties but the "name" field ReadProperties(0, 5); uint64_t pos = m_pFile->GetPosition(); uint64_t end = GetEnd(); if (pos == end) return; // take a peek at the next byte u_int8_t strLength; m_pFile->PeekBytes(&strLength, 1); // if the value matches the remaining atom length if (pos + strLength + 1 == end) { // read a counted string MP4StringProperty* pNameProp = (MP4StringProperty*)m_pProperties[5]; pNameProp->SetCountedFormat(true); ReadProperties(5); pNameProp->SetCountedFormat(false); } else { // read a null terminated string ReadProperties(5); } Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_hinf.cpp0000644010307701030770000000340010101411050020730 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4HinfAtom::MP4HinfAtom() : MP4Atom("hinf") { ExpectChildAtom("trpy", Optional, OnlyOne); ExpectChildAtom("nump", Optional, OnlyOne); ExpectChildAtom("tpyl", Optional, OnlyOne); ExpectChildAtom("maxr", Optional, Many); ExpectChildAtom("dmed", Optional, OnlyOne); ExpectChildAtom("dimm", Optional, OnlyOne); ExpectChildAtom("drep", Optional, OnlyOne); ExpectChildAtom("tmin", Optional, OnlyOne); ExpectChildAtom("tmax", Optional, OnlyOne); ExpectChildAtom("pmax", Optional, OnlyOne); ExpectChildAtom("dmax", Optional, OnlyOne); ExpectChildAtom("payt", Optional, OnlyOne); } void MP4HinfAtom::Generate() { // hinf is special in that although all it's child atoms // are optional (on read), if we generate it for writing // we really want all the children for (u_int32_t i = 0; i < m_pChildAtomInfos.Size(); i++) { MP4Atom* pChildAtom = CreateAtom(m_pChildAtomInfos[i]->m_name); AddChildAtom(pChildAtom); // and ask it to self generate pChildAtom->Generate(); } } faac-1.28/common/mp4v2/atom_hnti.cpp0000644010307701030770000000216010101411050020750 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4HntiAtom::MP4HntiAtom() : MP4Atom("hnti") { } void MP4HntiAtom::Read() { MP4Atom* grandParent = m_pParentAtom->GetParentAtom(); ASSERT(grandParent); if (ATOMID(grandParent->GetType()) == ATOMID("trak")) { ExpectChildAtom("sdp ", Optional, OnlyOne); } else { ExpectChildAtom("rtp ", Optional, OnlyOne); } MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_href.cpp0000644010307701030770000000212711136736372020767 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2005. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ #include "mp4common.h" MP4HrefAtom::MP4HrefAtom() : MP4Atom("href") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); ExpectChildAtom("burl", Optional, OnlyOne); } void MP4HrefAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); } faac-1.28/common/mp4v2/atom_mdat.cpp0000644010307701030770000000167610101411050020746 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4MdatAtom::MP4MdatAtom() : MP4Atom("mdat") { } void MP4MdatAtom::Read() { Skip(); } void MP4MdatAtom::Write() { // should never get here ASSERT(false); } faac-1.28/common/mp4v2/atom_mdhd.cpp0000644010307701030770000000436510101411050020733 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4MdhdAtom::MP4MdhdAtom() : MP4Atom("mdhd") { AddVersionAndFlags(); } void MP4MdhdAtom::AddProperties(u_int8_t version) { if (version == 1) { AddProperty( new MP4Integer64Property("creationTime")); AddProperty( new MP4Integer64Property("modificationTime")); } else { AddProperty( new MP4Integer32Property("creationTime")); AddProperty( new MP4Integer32Property("modificationTime")); } AddProperty( new MP4Integer32Property("timeScale")); if (version == 1) { AddProperty( new MP4Integer64Property("duration")); } else { AddProperty( new MP4Integer32Property("duration")); } AddProperty( new MP4Integer16Property("language")); AddReserved("reserved", 2); } void MP4MdhdAtom::Generate() { u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0; SetVersion(version); AddProperties(version); MP4Atom::Generate(); // set creation and modification times MP4Timestamp now = MP4GetAbsTimestamp(); if (version == 1) { ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); } else { ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); } } void MP4MdhdAtom::Read() { /* read atom version */ ReadProperties(0, 1); /* need to create the properties based on the atom version */ AddProperties(GetVersion()); /* now we can read the remaining properties */ ReadProperties(1); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_meta.cpp0000644010307701030770000000421311136736372020767 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * M. Bakker mbakker at nero.com * * Apple iTunes META data */ #include "mp4common.h" MP4Meta1Atom::MP4Meta1Atom(const char *name) : MP4Atom(name) { AddVersionAndFlags(); /* 0, 1 */ AddProperty(new MP4BytesProperty("metadata")); /* 2 */ } void MP4Meta1Atom::Read() { // calculate size of the metadata from the atom size ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 4); MP4Atom::Read(); } MP4DataAtom::MP4DataAtom() : MP4Atom("data") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved2", 4); /* 2 */ AddProperty( new MP4BytesProperty("metadata")); /* 3 */ } void MP4DataAtom::Read() { // calculate size of the metadata from the atom size ((MP4BytesProperty*)m_pProperties[3])->SetValueSize(m_size - 8); MP4Atom::Read(); } // MP4Meta2Atom is for \251nam and \251cmt flags, which appear differently // in .mov and in itunes file. In .movs, they appear under udata, in // itunes, they appear under ilst. MP4Meta2Atom::MP4Meta2Atom (const char *name) : MP4Atom(name) { } void MP4Meta2Atom::Read () { MP4Atom *parent = GetParentAtom(); if (ATOMID(parent->GetType()) == ATOMID("udta")) { // add data property AddReserved("reserved2", 4); /* 0 */ AddProperty( new MP4BytesProperty("metadata")); /* 1 */ ((MP4BytesProperty*)m_pProperties[1])->SetValueSize(m_size - 4); } else { ExpectChildAtom("data", Required, OnlyOne); } MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_mp4a.cpp0000644010307701030770000000312210101411050020646 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Mp4aAtom::MP4Mp4aAtom() : MP4Atom("mp4a") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("timeScale")); AddReserved("reserved3", 2); /* 4 */ ExpectChildAtom("esds", Required, OnlyOne); } void MP4Mp4aAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved2 has non-zero fixed values static u_int8_t reserved2[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, }; m_pProperties[2]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[2])-> SetValue(reserved2, sizeof(reserved2)); m_pProperties[2]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_mp4s.cpp0000644010307701030770000000211610101411050020672 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Mp4sAtom::MP4Mp4sAtom() : MP4Atom("mp4s") { AddReserved("reserved1", 6); AddProperty( new MP4Integer16Property("dataReferenceIndex")); ExpectChildAtom("esds", Required, OnlyOne); } void MP4Mp4sAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); } faac-1.28/common/mp4v2/atom_mp4v.cpp0000644010307701030770000000412210101411050020674 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Mp4vAtom::MP4Mp4vAtom() : MP4Atom("mp4v") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("width")); AddProperty( /* 4 */ new MP4Integer16Property("height")); AddReserved("reserved3", 14); /* 5 */ MP4StringProperty* pProp = new MP4StringProperty("compressorName"); pProp->SetFixedLength(32); pProp->SetValue(""); AddProperty(pProp); /* 6 */ AddReserved("reserved4", 4); /* 7 */ ExpectChildAtom("esds", Required, OnlyOne); } void MP4Mp4vAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved3 has non-zero fixed values static u_int8_t reserved3[14] = { 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, }; m_pProperties[5]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[5])-> SetValue(reserved3, sizeof(reserved3)); m_pProperties[5]->SetReadOnly(true); // property reserved4 has non-zero fixed values static u_int8_t reserved4[4] = { 0x00, 0x18, 0xFF, 0xFF, }; m_pProperties[7]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[7])-> SetValue(reserved4, sizeof(reserved4)); m_pProperties[7]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_mvhd.cpp0000644010307701030770000000676610101411050020764 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4MvhdAtom::MP4MvhdAtom() : MP4Atom("mvhd") { AddVersionAndFlags(); } void MP4MvhdAtom::AddProperties(u_int8_t version) { if (version == 1) { AddProperty( /* 2 */ new MP4Integer64Property("creationTime")); AddProperty( /* 3 */ new MP4Integer64Property("modificationTime")); } else { AddProperty( /* 2 */ new MP4Integer32Property("creationTime")); AddProperty( /* 3 */ new MP4Integer32Property("modificationTime")); } AddProperty( /* 4 */ new MP4Integer32Property("timeScale")); if (version == 1) { AddProperty( /* 5 */ new MP4Integer64Property("duration")); } else { AddProperty( /* 5 */ new MP4Integer32Property("duration")); } MP4Float32Property* pProp; pProp = new MP4Float32Property("rate"); pProp->SetFixed32Format(); AddProperty(pProp); /* 6 */ pProp = new MP4Float32Property("volume"); pProp->SetFixed16Format(); AddProperty(pProp); /* 7 */ AddReserved("reserved1", 70); /* 8 */ AddProperty( /* 9 */ new MP4Integer32Property("nextTrackId")); } void MP4MvhdAtom::Generate() { u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0; SetVersion(version); AddProperties(version); MP4Atom::Generate(); // set creation and modification times MP4Timestamp now = MP4GetAbsTimestamp(); if (version == 1) { ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); } else { ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); } ((MP4Integer32Property*)m_pProperties[4])->SetValue(1000); ((MP4Float32Property*)m_pProperties[6])->SetValue(1.0); ((MP4Float32Property*)m_pProperties[7])->SetValue(1.0); // property reserved has non-zero fixed values static u_int8_t reserved[70] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; m_pProperties[8]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[8])-> SetValue(reserved, sizeof(reserved)); m_pProperties[8]->SetReadOnly(true); // set next track id ((MP4Integer32Property*)m_pProperties[9])->SetValue(1); } void MP4MvhdAtom::Read() { /* read atom version */ ReadProperties(0, 1); /* need to create the properties based on the atom version */ AddProperties(GetVersion()); /* now we can read the remaining properties */ ReadProperties(1); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_ohdr.cpp0000644010307701030770000000572711136736372021010 0ustar fabian-guestfabian-guest/** \file atom_ohdr.cpp \author Danijel Kopcinovic (danijel.kopcinovic@adnecto.net) */ #include "mp4common.h" /*! \brief Patch class for read/write operations when string is 0-length. We want to use string property, but mpeg4ip doesn't support ohdr way of encoding of string (in ohdr atom we first have 3 lengths of 3 strings and then their string values, and it cannot be simulated with any of the current mpeg4ip string property parameters), so we have to write our own Read() and Write() routines. */ class OhdrMP4StringProperty: public MP4StringProperty { public: /*! \brief Constructor. \param name name of the property. \param useCountedFormat counted format flag. \param useUnicode unicode flag. */ OhdrMP4StringProperty(char* name, bool useCountedFormat = false, bool useUnicode = false): MP4StringProperty(name, useCountedFormat, useUnicode) { } /*! \brief Read property from file. \param pFile input, file handle. \param index input, index to read. */ void Read(MP4File* pFile, u_int32_t index = 0) { MP4Free(m_values[index]); m_values[index] = (char*)MP4Calloc(m_fixedLength + 1); (void)pFile->ReadBytes((u_int8_t*)m_values[index], m_fixedLength); } /*! \brief Write property to file. \param pFile input, file handle. \param index input, index to write. */ void Write(MP4File* pFile, u_int32_t index = 0) { pFile->WriteBytes((u_int8_t*)m_values[index], m_fixedLength); } }; /*! \brief OMA DRM headers atom. Contained in OMA DRM key management atom. It must contain content identifier. */ /*! \brief Constructor. */ MP4OhdrAtom::MP4OhdrAtom(): MP4Atom("ohdr") { AddVersionAndFlags(); AddProperty(new MP4Integer8Property("EncryptionMethod")); AddProperty(new MP4Integer8Property("EncryptionPadding")); AddProperty(new MP4Integer64Property("PlaintextLength")); AddProperty(new MP4Integer16Property("ContentIDLength")); AddProperty(new MP4Integer16Property("RightsIssuerURLLength")); AddProperty(new MP4Integer16Property("TextualHeadersLength")); AddProperty(new OhdrMP4StringProperty("ContentID")); AddProperty(new OhdrMP4StringProperty("RightsIssuerURL")); AddProperty(new MP4BytesProperty("TextualHeaders")); } MP4OhdrAtom::~MP4OhdrAtom() { } /*! \brief Read atom. */ void MP4OhdrAtom::Read() { ReadProperties(0, 8); MP4Property* lProperty; MP4Property* property; lProperty = GetProperty(5); property = GetProperty(8); ((OhdrMP4StringProperty*)property)->SetFixedLength( ((MP4Integer16Property*)lProperty)->GetValue()); lProperty = GetProperty(6); property = GetProperty(9); ((OhdrMP4StringProperty*)property)->SetFixedLength( ((MP4Integer16Property*)lProperty)->GetValue()); lProperty = GetProperty(7); property = GetProperty(10); ((MP4BytesProperty*)property)->SetFixedSize( ((MP4Integer16Property*)lProperty)->GetValue()); ReadProperties(8, 3); } faac-1.28/common/mp4v2/atom_root.cpp0000644010307701030770000000610511136736372021026 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4RootAtom::MP4RootAtom() : MP4Atom(NULL) { ExpectChildAtom("moov", Required, OnlyOne); ExpectChildAtom("ftyp", Optional, OnlyOne); ExpectChildAtom("mdat", Optional, Many); ExpectChildAtom("free", Optional, Many); ExpectChildAtom("skip", Optional, Many); ExpectChildAtom("udta", Optional, Many); ExpectChildAtom("moof", Optional, Many); } void MP4RootAtom::BeginWrite(bool use64) { // only call under MP4Create() control WriteAtomType("ftyp", OnlyOne); m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits("mdat")); } void MP4RootAtom::Write() { // no-op } void MP4RootAtom::FinishWrite(bool use64) { // finish writing last mdat atom u_int32_t mdatIndex = GetLastMdatIndex(); m_pChildAtoms[mdatIndex]->FinishWrite(m_pFile->Use64Bits("mdat")); // write all atoms after last mdat u_int32_t size = m_pChildAtoms.Size(); for (u_int32_t i = mdatIndex + 1; i < size; i++) { m_pChildAtoms[i]->Write(); } } void MP4RootAtom::BeginOptimalWrite() { WriteAtomType("ftyp", OnlyOne); WriteAtomType("moov", OnlyOne); WriteAtomType("udta", Many); m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits("mdat")); } void MP4RootAtom::FinishOptimalWrite() { // finish writing mdat m_pChildAtoms[GetLastMdatIndex()]->FinishWrite(m_pFile->Use64Bits("mdat")); // find moov atom u_int32_t size = m_pChildAtoms.Size(); MP4Atom* pMoovAtom = NULL; u_int32_t i; for (i = 0; i < size; i++) { if (!strcmp("moov", m_pChildAtoms[i]->GetType())) { pMoovAtom = m_pChildAtoms[i]; break; } } ASSERT(i < size); ASSERT(pMoovAtom != NULL); // rewrite moov so that updated chunkOffsets are written to disk m_pFile->SetPosition(pMoovAtom->GetStart()); u_int64_t oldSize = pMoovAtom->GetSize(); pMoovAtom->Write(); // sanity check u_int64_t newSize = pMoovAtom->GetSize(); ASSERT(oldSize == newSize); } u_int32_t MP4RootAtom::GetLastMdatIndex() { for (int32_t i = m_pChildAtoms.Size() - 1; i >= 0; i--) { if (!strcmp("mdat", m_pChildAtoms[i]->GetType())) { return i; } } ASSERT(false); return (u_int32_t)-1; } void MP4RootAtom::WriteAtomType(const char* type, bool onlyOne) { u_int32_t size = m_pChildAtoms.Size(); for (u_int32_t i = 0; i < size; i++) { if (!strcmp(type, m_pChildAtoms[i]->GetType())) { m_pChildAtoms[i]->Write(); if (onlyOne) { break; } } } } faac-1.28/common/mp4v2/atom_rtp.cpp0000644010307701030770000000745111136736372020655 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4RtpAtom::MP4RtpAtom() : MP4Atom("rtp ") { // The atom type "rtp " is used in two complete unrelated ways // i.e. it's real two atoms with the same name // To handle that we need to postpone property creation until // we know who our parent atom is (stsd or hnti) which gives us // the context info we need to know who we are } void MP4RtpAtom::AddPropertiesStsdType() { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddProperty( /* 2 */ new MP4Integer16Property("hintTrackVersion")); AddProperty( /* 3 */ new MP4Integer16Property("highestCompatibleVersion")); AddProperty( /* 4 */ new MP4Integer32Property("maxPacketSize")); ExpectChildAtom("tims", Required, OnlyOne); ExpectChildAtom("tsro", Optional, OnlyOne); ExpectChildAtom("snro", Optional, OnlyOne); } void MP4RtpAtom::AddPropertiesHntiType() { MP4StringProperty* pProp = new MP4StringProperty("descriptionFormat"); pProp->SetFixedLength(4); AddProperty(pProp); /* 0 */ AddProperty( /* 1 */ new MP4StringProperty("sdpText")); } void MP4RtpAtom::Generate() { if (!strcmp(m_pParentAtom->GetType(), "stsd")) { AddPropertiesStsdType(); GenerateStsdType(); } else if (!strcmp(m_pParentAtom->GetType(), "hnti")) { AddPropertiesHntiType(); GenerateHntiType(); } else { VERBOSE_WARNING(m_pFile->GetVerbosity(), printf("Warning: rtp atom in unexpected context, can not generate")); } } void MP4RtpAtom::GenerateStsdType() { // generate children MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); ((MP4Integer16Property*)m_pProperties[2])->SetValue(1); ((MP4Integer16Property*)m_pProperties[3])->SetValue(1); } void MP4RtpAtom::GenerateHntiType() { MP4Atom::Generate(); ((MP4StringProperty*)m_pProperties[0])->SetValue("sdp "); } void MP4RtpAtom::Read() { if (!strcmp(m_pParentAtom->GetType(), "stsd")) { AddPropertiesStsdType(); ReadStsdType(); } else if (!strcmp(m_pParentAtom->GetType(), "hnti")) { AddPropertiesHntiType(); ReadHntiType(); } else { VERBOSE_READ(m_pFile->GetVerbosity(), printf("rtp atom in unexpected context, can not read")); } Skip(); // to end of atom } void MP4RtpAtom::ReadStsdType() { MP4Atom::Read(); } void MP4RtpAtom::ReadHntiType() { ReadProperties(0, 1); // read sdp string, length is implicit in size of atom u_int64_t size = GetEnd() - m_pFile->GetPosition(); char* data = (char*)MP4Malloc(size + 1); ASSERT(data != NULL); m_pFile->ReadBytes((u_int8_t*)data, size); data[size] = '\0'; ((MP4StringProperty*)m_pProperties[1])->SetValue(data); MP4Free(data); } void MP4RtpAtom::Write() { if (!strcmp(m_pParentAtom->GetType(), "hnti")) { WriteHntiType(); } else { MP4Atom::Write(); } } void MP4RtpAtom::WriteHntiType() { // since length of string is implicit in size of atom // we need to handle this specially, and not write the terminating \0 MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[1]; pSdp->SetFixedLength(strlen(pSdp->GetValue())); MP4Atom::Write(); pSdp->SetFixedLength(0); } faac-1.28/common/mp4v2/atom_s263.cpp0000644010307701030770000000414710101411050020512 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" MP4S263Atom::MP4S263Atom() : MP4Atom("s263") { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("width")); AddProperty( /* 4 */ new MP4Integer16Property("height")); AddReserved("reserved3", 50); /* 5 */ ExpectChildAtom("d263", Required, OnlyOne); } void MP4S263Atom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved2 has non-zero fixed values static u_int8_t reserved3[50] = { 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF }; m_pProperties[5]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[5])-> SetValue(reserved3, sizeof(reserved3)); m_pProperties[5]->SetReadOnly(true); } faac-1.28/common/mp4v2/atom_sdp.cpp0000644010307701030770000000310311136736372020624 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4SdpAtom::MP4SdpAtom() : MP4Atom("sdp ") { AddProperty( new MP4StringProperty("sdpText")); } void MP4SdpAtom::Read() { // read sdp string, length is implicit in size of atom u_int64_t size = GetEnd() - m_pFile->GetPosition(); char* data = (char*)MP4Malloc(size + 1); ASSERT(data != NULL); m_pFile->ReadBytes((u_int8_t*)data, size); data[size] = '\0'; ((MP4StringProperty*)m_pProperties[0])->SetValue(data); MP4Free(data); } void MP4SdpAtom::Write() { // since length of string is implicit in size of atom // we need to handle this specially, and not write the terminating \0 MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[0]; const char* sdpText = pSdp->GetValue(); if (sdpText) { pSdp->SetFixedLength(strlen(sdpText)); } MP4Atom::Write(); pSdp->SetFixedLength(0); } faac-1.28/common/mp4v2/atom_smi.cpp0000644010307701030770000000207611136736372020636 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com * * Apple iTunes META data */ #include "mp4common.h" MP4SmiAtom::MP4SmiAtom() : MP4Atom("meta") { AddProperty( new MP4BytesProperty("metadata")); } void MP4SmiAtom::Read() { // calculate size of the metadata from the atom size ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_sound.cpp0000644010307701030770000000744011136736372021176 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ #include "mp4common.h" MP4SoundAtom::MP4SoundAtom(const char *atomid) : MP4Atom(atomid) { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddProperty( /* 2 */ new MP4Integer16Property("soundVersion")); AddReserved( "reserved2", 6); /* 3 */ AddProperty( /* 4 */ new MP4Integer16Property("channels")); AddProperty( /* 5 */ new MP4Integer16Property("sampleSize")); AddProperty( /* 6 */ new MP4Integer16Property("packetSize")); AddProperty( /* 7 */ new MP4Integer32Property("timeScale")); if (ATOMID(atomid) == ATOMID("mp4a")) { AddReserved("reserved3", 2); /* 8 */ ExpectChildAtom("esds", Required, OnlyOne); ExpectChildAtom("wave", Optional, OnlyOne); } else if (ATOMID(atomid) == ATOMID("alac")) { AddReserved("reserved3", 2); /* 8 */ ExpectChildAtom("alac", Optional, Optional); //AddProperty( new MP4BytesProperty("alacInfo", 36)); } } void MP4SoundAtom::AddProperties (uint8_t version) { if (version > 0) { AddProperty( /* 8 */ new MP4Integer32Property("samplesPerPacket")); AddProperty( /* 9 */ new MP4Integer32Property("bytesPerPacket")); AddProperty( /* 10 */ new MP4Integer32Property("bytesPerFrame")); AddProperty( /* 11 */ new MP4Integer32Property("bytesPerSample")); } if (version == 2) { AddReserved("reserved4", 20); } } void MP4SoundAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved2 has non-zero fixed values ((MP4Integer16Property*)m_pProperties[2])->SetValue(0); static const u_int8_t reserved2[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; m_pProperties[3]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[3])-> SetValue(reserved2, sizeof(reserved2)); m_pProperties[3]->SetReadOnly(true); ((MP4Integer16Property*)m_pProperties[4])->SetValue(2); ((MP4Integer16Property*)m_pProperties[5])->SetValue(0x0010); ((MP4Integer16Property*)m_pProperties[6])->SetValue(0); } void MP4SoundAtom::Read() { MP4Atom *parent = GetParentAtom(); if (ATOMID(parent->GetType()) != ATOMID("stsd")) { // Quicktime has an interesting thing - they'll put an mp4a atom // which is blank inside a wave atom, which is inside an mp4a atom // we have a mp4a inside an wave inside an mp4a - delete all properties m_pProperties.Delete(8); m_pProperties.Delete(7); m_pProperties.Delete(6); m_pProperties.Delete(5); m_pProperties.Delete(4); m_pProperties.Delete(3); m_pProperties.Delete(2); m_pProperties.Delete(1); m_pProperties.Delete(0); if (ATOMID(GetType()) == ATOMID("alac")) { AddProperty(new MP4BytesProperty("decoderConfig", m_size)); ReadProperties(); } if (m_pChildAtomInfos.Size() > 0) { ReadChildAtoms(); } } else { ReadProperties(0, 3); // read first 3 properties AddProperties(((MP4IntegerProperty *)m_pProperties[2])->GetValue()); ReadProperties(3); // continue if (m_pChildAtomInfos.Size() > 0) { ReadChildAtoms(); } } Skip(); } faac-1.28/common/mp4v2/atom_standard.cpp0000644010307701030770000003714711136736372021655 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May (from others work). */ #include "mp4common.h" #include "atoms.h" static const char name[5]={0251,'n', 'a', 'm', '\0'}; static const char art[5]={0251,'A', 'R', 'T', '\0'}; static const char wrt[5]={0251,'w', 'r', 't', '\0'}; static const char alb[5]={0251,'a', 'l', 'b', '\0'}; static const char day[5]={0251,'d', 'a', 'y', '\0'}; static const char too[5]={0251,'t', 'o', 'o', '\0'}; static const char cmt[5]={0251,'c', 'm', 't', '\0'}; static const char gen[5]={0251,'g', 'e', 'n', '\0'}; static const char grp[5]={0251,'g', 'r', 'p', '\0'}; MP4StandardAtom::MP4StandardAtom (const char *type) : MP4Atom(type) { /* * This is a big if else loop. Make sure that you don't break it * when adding new atoms, or you will set the unknown type flag * * Try to keep it in alphabetical order - it should only be called * 1 time per atom, so it's not that urgent. */ if (ATOMID(type) == ATOMID("aART") || ATOMID(type) == ATOMID("akID") || ATOMID(type) == ATOMID("apID") || ATOMID(type) == ATOMID("atID")) { ExpectChildAtom("data", Required, OnlyOne); /* * b??? */ } else if (ATOMID(type) == ATOMID("bitr")) { AddProperty( /* 0 */ new MP4Integer32Property("avgBitrate")); AddProperty( /* 1 */ new MP4Integer32Property("maxBitrate")); } else if (ATOMID(type) == ATOMID("btrt")) { AddProperty( new MP4Integer32Property("bufferSizeDB")); /* 0 */ AddProperty( new MP4Integer32Property("avgBitrate")); /* 1 */ AddProperty( new MP4Integer32Property("maxBitrate")); /* 2 */ } else if (ATOMID(type) == ATOMID("burl")) { AddProperty( new MP4StringProperty("base_url")); /* * c??? */ } else if (ATOMID(type) == ATOMID("co64")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer64Property("chunkOffset")); } else if (ATOMID(type) == ATOMID("cpil")) { ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */ ExpectChildAtom("data", Required, Many); } else if (ATOMID(type) == ATOMID("cprt") || ATOMID(type) == ATOMID("cnID")) { #if 0 AddVersionAndFlags(); AddProperty( new MP4Integer16Property("language")); AddProperty( new MP4StringProperty("notice")); #else ExpectChildAtom("data", Required, OnlyOne); #endif } else if (ATOMID(type) == ATOMID("ctts")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleCount")); pTable->AddProperty(new MP4Integer32Property("sampleOffset")); /* * d??? */ } else if (ATOMID(type) == ATOMID("dinf")) { ExpectChildAtom("dref", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("dimm")) { AddProperty( // bytes of immediate data new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */ ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("dmax")) { AddProperty( // max packet duration new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("dmed")) { AddProperty( // bytes sent from media data new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("drep")) { AddProperty( // bytes of repeated data new MP4Integer64Property("bytes")); /* * e??? */ } else if (ATOMID(type) == ATOMID("edts")) { ExpectChildAtom("elst", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("esds")) { AddVersionAndFlags(); AddProperty( new MP4DescriptorProperty(NULL, MP4ESDescrTag, 0, Required, OnlyOne)); /* * f??? */ } else if (ATOMID(type) == ATOMID("frma")) { AddProperty( /* 0 */ new MP4Integer32Property("data-format")); /* * g??? */ } else if (ATOMID(type) == ATOMID("gmhd")) { ExpectChildAtom("gmin", Required, OnlyOne); ExpectChildAtom("tmcd", Optional, OnlyOne); ExpectChildAtom("text", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("gnre") || ATOMID(type) == ATOMID("geID")) { // Apple iTunes ExpectChildAtom("data", Optional, OnlyOne); /* * h??? */ } else if (ATOMID(type) == ATOMID("hmhd")) { AddVersionAndFlags(); AddProperty(new MP4Integer16Property("maxPduSize")); AddProperty(new MP4Integer16Property("avgPduSize")); AddProperty(new MP4Integer32Property("maxBitRate")); AddProperty(new MP4Integer32Property("avgBitRate")); AddProperty(new MP4Integer32Property("slidingAvgBitRate")); /* * i??? */ } else if (ATOMID(type) == ATOMID("iKMS")) { AddVersionAndFlags(); /* 0, 1 */ MP4StringProperty* pProp = new MP4StringProperty("kms_URI"); AddProperty(pProp); /* 2 */ } else if (ATOMID(type) == ATOMID("iSFM")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4BitfieldProperty("selective-encryption", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("reserved", 7)); AddProperty( /* 4 */ new MP4Integer8Property("key-indicator-length")); AddProperty( /* 5 */ new MP4Integer8Property("IV-length")); } else if (ATOMID(type) == ATOMID("ilst")) { ExpectChildAtom("\251nam", Optional, OnlyOne); /* name */ ExpectChildAtom("\251ART", Optional, OnlyOne); /* artist */ ExpectChildAtom("\251wrt", Optional, OnlyOne); /* writer */ ExpectChildAtom("\251alb", Optional, OnlyOne); /* album */ ExpectChildAtom("\251day", Optional, OnlyOne); /* date */ ExpectChildAtom("\251too", Optional, OnlyOne); /* tool */ ExpectChildAtom("\251cmt", Optional, OnlyOne); /* comment */ ExpectChildAtom("\251gen", Optional, OnlyOne); /* custom genre */ ExpectChildAtom("trkn", Optional, OnlyOne); /* tracknumber */ ExpectChildAtom("disk", Optional, OnlyOne); /* disknumber */ ExpectChildAtom("gnre", Optional, OnlyOne); /* genre (ID3v1 index + 1) */ ExpectChildAtom("cpil", Optional, OnlyOne); /* compilation */ ExpectChildAtom("tmpo", Optional, OnlyOne); /* BPM */ ExpectChildAtom("covr", Optional, OnlyOne); /* cover art */ ExpectChildAtom("aART", Optional, OnlyOne); /* album artist */ ExpectChildAtom("----", Optional, Many); /* ---- free form */ ExpectChildAtom("pgap", Optional, OnlyOne); /* part of gapless album */ } else if (ATOMID(type) == ATOMID("imif")) { AddVersionAndFlags(); AddProperty(new MP4DescriptorProperty("ipmp_desc", MP4IPMPDescrTag, MP4IPMPDescrTag, Required, Many)); } else if (ATOMID(type) == ATOMID("iods")) { AddVersionAndFlags(); AddProperty( new MP4DescriptorProperty(NULL, MP4FileIODescrTag, MP4FileODescrTag, Required, OnlyOne)); /* * m??? */ } else if (ATOMID(type) == ATOMID("maxr")) { AddProperty(new MP4Integer32Property("granularity")); AddProperty(new MP4Integer32Property("bytes")); } else if (ATOMID(type) == ATOMID("mdia")) { ExpectChildAtom("mdhd", Required, OnlyOne); ExpectChildAtom("hdlr", Required, OnlyOne); ExpectChildAtom("minf", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("meta")) { // iTunes AddVersionAndFlags(); /* 0, 1 */ ExpectChildAtom("hdlr", Required, OnlyOne); ExpectChildAtom("ilst", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("mfhd")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sequenceNumber")); } else if (ATOMID(type) == ATOMID("minf")) { ExpectChildAtom("vmhd", Optional, OnlyOne); ExpectChildAtom("smhd", Optional, OnlyOne); ExpectChildAtom("hmhd", Optional, OnlyOne); ExpectChildAtom("nmhd", Optional, OnlyOne); ExpectChildAtom("gmhd", Optional, OnlyOne); ExpectChildAtom("dinf", Required, OnlyOne); ExpectChildAtom("stbl", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("moof")) { ExpectChildAtom("mfhd", Required, OnlyOne); ExpectChildAtom("traf", Optional, Many); } else if (ATOMID(type) == ATOMID("moov")) { ExpectChildAtom("mvhd", Required, OnlyOne); ExpectChildAtom("iods", Optional, OnlyOne); ExpectChildAtom("trak", Required, Many); ExpectChildAtom("udta", Optional, Many); ExpectChildAtom("mvex", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("mvex")) { ExpectChildAtom("trex", Required, Many); /* * n??? */ } else if (ATOMID(type) == ATOMID("nmhd")) { AddVersionAndFlags(); } else if (ATOMID(type) == ATOMID("nump")) { AddProperty( // packets sent new MP4Integer64Property("packets")); /* * o??? */ } else if (ATOMID(type) == ATOMID("odkm")) { AddVersionAndFlags(); ExpectChildAtom("ohdr", Required, OnlyOne); /* * p??? */ } else if (ATOMID(type) == ATOMID("payt")) { AddProperty(new MP4Integer32Property("payloadNumber")); AddProperty(new MP4StringProperty("rtpMap", Counted)); } else if (ATOMID(type) == ATOMID("pinf")) { ExpectChildAtom("frma", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("pmax")) { AddProperty( // max packet size new MP4Integer32Property("bytes")); } else if (ATOMID(type) == ATOMID("pgap") || ATOMID(type) == ATOMID("plID") || ATOMID(type) == ATOMID("purd") || ATOMID(type) == ATOMID("rtng")) { ExpectChildAtom("data", Required, OnlyOne); /* * s??? */ } else if (ATOMID(type) == ATOMID("schi")) { // not sure if this is child atoms or table of boxes // get clarification on spec 9.1.2.5 ExpectChildAtom("odkm", Optional, OnlyOne); ExpectChildAtom("iKMS", Optional, OnlyOne); ExpectChildAtom("iSFM", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("schm")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("scheme_type")); AddProperty( /* 3 */ new MP4Integer32Property("scheme_version")); // browser URI if flags set, TODO } else if (ATOMID(type) == ATOMID("sinf")) { ExpectChildAtom("frma", Required, OnlyOne); ExpectChildAtom("imif", Optional, OnlyOne); ExpectChildAtom("schm", Optional, OnlyOne); ExpectChildAtom("schi", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("smhd")) { AddVersionAndFlags(); AddReserved("reserved", 4); } else if (ATOMID(type) == ATOMID("snro")) { AddProperty(new MP4Integer32Property("offset")); } else if (ATOMID(type) == ATOMID("stco")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("chunkOffset")); } else if (ATOMID(type) == ATOMID("stsh")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("shadowedSampleNumber")); pTable->AddProperty(new MP4Integer32Property("syncSampleNumber")); } else if (ATOMID(type) == ATOMID("stss")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleNumber")); } else if (ATOMID(type) == ATOMID("stts")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleCount")); pTable->AddProperty(new MP4Integer32Property("sampleDelta")); } else if (ATOMID(type) == ATOMID("sfID") || ATOMID(type) == ATOMID("stik")) { ExpectChildAtom("data", Required, OnlyOne); /* * t??? */ } else if (ATOMID(type) == ATOMID("tims")) { AddProperty( new MP4Integer32Property("timeScale")); } else if (ATOMID(type) == ATOMID("tmin")) { AddProperty( // min relative xmit time new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("tmax")) { AddProperty( // max relative xmit time new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("traf")) { ExpectChildAtom("tfhd", Required, OnlyOne); ExpectChildAtom("trun", Optional, Many); } else if (ATOMID(type) == ATOMID("trak")) { ExpectChildAtom("tkhd", Required, OnlyOne); ExpectChildAtom("tref", Optional, OnlyOne); ExpectChildAtom("edts", Optional, OnlyOne); ExpectChildAtom("mdia", Required, OnlyOne); ExpectChildAtom("udta", Optional, Many); } else if (ATOMID(type) == ATOMID("tref")) { ExpectChildAtom("chap", Optional, OnlyOne); ExpectChildAtom("dpnd", Optional, OnlyOne); ExpectChildAtom("hint", Optional, OnlyOne); ExpectChildAtom("ipir", Optional, OnlyOne); ExpectChildAtom("mpod", Optional, OnlyOne); ExpectChildAtom("sync", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("trex")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("trackId")); AddProperty( /* 3 */ new MP4Integer32Property("defaultSampleDesriptionIndex")); AddProperty( /* 4 */ new MP4Integer32Property("defaultSampleDuration")); AddProperty( /* 5 */ new MP4Integer32Property("defaultSampleSize")); AddProperty( /* 6 */ new MP4Integer32Property("defaultSampleFlags")); } else if (ATOMID(type) == ATOMID("trkn")) { // iTunes ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("trpy") || ATOMID(type) == ATOMID("tpyl")) { AddProperty( // bytes sent including RTP headers new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("tsro")) { AddProperty( new MP4Integer32Property("offset")); } else if (ATOMID(type) == ATOMID("wave")) { ExpectChildAtom("esds", Required, OnlyOne); /* * copyright??? */ } else if (ATOMID(type) == ATOMID(art) || ATOMID(type) == ATOMID(wrt) || ATOMID(type) == ATOMID(alb) || ATOMID(type) == ATOMID(day) || ATOMID(type) == ATOMID(too) || ATOMID(type) == ATOMID(gen) || ATOMID(type) == ATOMID(grp)) { /* Apple iTunes */ ExpectChildAtom("data", Required, OnlyOne); /* * ---- */ } else if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */ ExpectChildAtom("mean", Required, OnlyOne); ExpectChildAtom("name", Required, OnlyOne); ExpectChildAtom("data", Required, OnlyOne); } else { /* * default - unknown type */ SetUnknownType(true); } } faac-1.28/common/mp4v2/atom_stbl.cpp0000644010307701030770000000327211136736372021011 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4StblAtom::MP4StblAtom() : MP4Atom("stbl") { ExpectChildAtom("stsd", Required, OnlyOne); ExpectChildAtom("stts", Required, OnlyOne); ExpectChildAtom("ctts", Optional, OnlyOne); ExpectChildAtom("stsz", Required, OnlyOne); ExpectChildAtom("stz2", Optional, OnlyOne); ExpectChildAtom("stsc", Required, OnlyOne); ExpectChildAtom("stco", Optional, OnlyOne); ExpectChildAtom("co64", Optional, OnlyOne); ExpectChildAtom("stss", Optional, OnlyOne); ExpectChildAtom("stsh", Optional, OnlyOne); ExpectChildAtom("stdp", Optional, OnlyOne); } void MP4StblAtom::Generate() { // as usual MP4Atom::Generate(); // but we also need one of the chunk offset atoms MP4Atom* pChunkOffsetAtom; if (m_pFile->Use64Bits(GetType())) { pChunkOffsetAtom = CreateAtom("co64"); } else { pChunkOffsetAtom = CreateAtom("stco"); } AddChildAtom(pChunkOffsetAtom); // and ask it to self generate pChunkOffsetAtom->Generate(); } faac-1.28/common/mp4v2/atom_stdp.cpp0000644010307701030770000000264310101411050020766 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4StdpAtom::MP4StdpAtom() : MP4Atom("stdp") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetImplicit(); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer16Property("priority")); } void MP4StdpAtom::Read() { // table entry count computed from atom size ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false); ((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 4) / 2); ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true); MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_stsc.cpp0000644010307701030770000000446010101411050020767 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4StscAtom::MP4StscAtom() : MP4Atom("stsc") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer32Property("firstChunk")); pTable->AddProperty( new MP4Integer32Property("samplesPerChunk")); pTable->AddProperty( new MP4Integer32Property("sampleDescriptionIndex")); // As an optimization we add an implicit property to this table, // "firstSample" that corresponds to the first sample of the firstChunk MP4Integer32Property* pSample = new MP4Integer32Property("firstSample"); pSample->SetImplicit(); pTable->AddProperty(pSample); } void MP4StscAtom::Read() { // Read as usual MP4Atom::Read(); // Compute the firstSample values for later use u_int32_t count = ((MP4Integer32Property*)m_pProperties[2])->GetValue(); MP4Integer32Property* pFirstChunk = (MP4Integer32Property*) ((MP4TableProperty*)m_pProperties[3])->GetProperty(0); MP4Integer32Property* pSamplesPerChunk = (MP4Integer32Property*) ((MP4TableProperty*)m_pProperties[3])->GetProperty(1); MP4Integer32Property* pFirstSample = (MP4Integer32Property*) ((MP4TableProperty*)m_pProperties[3])->GetProperty(3); MP4SampleId sampleId = 1; for (u_int32_t i = 0; i < count; i++) { pFirstSample->SetValue(sampleId, i); if (i < count - 1) { sampleId += (pFirstChunk->GetValue(i+1) - pFirstChunk->GetValue(i)) * pSamplesPerChunk->GetValue(i); } } } faac-1.28/common/mp4v2/atom_stsd.cpp0000644010307701030770000000446111136736372021023 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" MP4StsdAtom::MP4StsdAtom() : MP4Atom("stsd") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetReadOnly(); AddProperty(pCount); ExpectChildAtom("mp4a", Optional, Many); ExpectChildAtom("enca", Optional, Many); ExpectChildAtom("mp4s", Optional, Many); ExpectChildAtom("mp4v", Optional, Many); ExpectChildAtom("encv", Optional, Many); ExpectChildAtom("rtp ", Optional, Many); ExpectChildAtom("samr", Optional, Many); // For AMR-NB ExpectChildAtom("sawb", Optional, Many); // For AMR-WB ExpectChildAtom("s263", Optional, Many); // For H.263 ExpectChildAtom("avc1", Optional, Many); ExpectChildAtom("alac", Optional, Many); ExpectChildAtom("text", Optional, Many); } void MP4StsdAtom::Read() { /* do the usual read */ MP4Atom::Read(); // check that number of children == entryCount MP4Integer32Property* pCount = (MP4Integer32Property*)m_pProperties[2]; if (m_pChildAtoms.Size() != pCount->GetValue()) { VERBOSE_READ(GetVerbosity(), printf("Warning: stsd inconsistency with number of entries")); /* fix it */ pCount->SetReadOnly(false); pCount->SetValue(m_pChildAtoms.Size()); pCount->SetReadOnly(true); } } faac-1.28/common/mp4v2/atom_stsz.cpp0000644010307701030770000000346511136736372021054 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4StszAtom::MP4StszAtom() : MP4Atom("stsz") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sampleSize")); MP4Integer32Property* pCount = new MP4Integer32Property("sampleCount"); AddProperty(pCount); /* 3 */ MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); /* 4 */ pTable->AddProperty( /* 4/0 */ new MP4Integer32Property("entrySize")); } void MP4StszAtom::Read() { ReadProperties(0, 4); u_int32_t sampleSize = ((MP4Integer32Property*)m_pProperties[2])->GetValue(); // only attempt to read entries table if sampleSize is zero // i.e sample size is not constant m_pProperties[4]->SetImplicit(sampleSize != 0); ReadProperties(4); Skip(); // to end of atom } void MP4StszAtom::Write() { u_int32_t sampleSize = ((MP4Integer32Property*)m_pProperties[2])->GetValue(); // only attempt to write entries table if sampleSize is zero // i.e sample size is not constant m_pProperties[4]->SetImplicit(sampleSize != 0); MP4Atom::Write(); } faac-1.28/common/mp4v2/atom_stz2.cpp0000644010307701030770000000457411136736372020755 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" /* * This is used for the 4 bit sample size below. We need the sampleCount * to be correct for the number of samples, but the table size needs to * be correct to read and write it. */ class MP4HalfSizeTableProperty : public MP4TableProperty { public: MP4HalfSizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) : MP4TableProperty(name, pCountProperty) {}; // The count is half the actual size u_int32_t GetCount() { return (m_pCountProperty->GetValue() + 1)/ 2; }; void SetCount(u_int32_t count) { m_pCountProperty->SetValue(count * 2); }; }; MP4Stz2Atom::MP4Stz2Atom() : MP4Atom("stz2") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved", 3); /* 2 */ AddProperty( /* 3 */ new MP4Integer8Property("fieldSize")); MP4Integer32Property* pCount = new MP4Integer32Property("sampleCount"); AddProperty(pCount); /* 4 */ } void MP4Stz2Atom::Read() { ReadProperties(0, 4); uint8_t fieldSize = ((MP4Integer8Property *)m_pProperties[3])->GetValue(); // uint32_t sampleCount = 0; MP4Integer32Property* pCount = (MP4Integer32Property *)m_pProperties[4]; MP4TableProperty *pTable; if (fieldSize != 4) { pTable = new MP4TableProperty("entries", pCount); } else { // 4 bit field size uses a special table. pTable = new MP4HalfSizeTableProperty("entries", pCount); } AddProperty(pTable); if (fieldSize == 16) { pTable->AddProperty( /* 5/0 */ new MP4Integer16Property("entrySize")); } else { pTable->AddProperty( /* 5/0 */ new MP4Integer8Property("entrySize")); } ReadProperties(4); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_text.cpp0000644010307701030770000000713311136736372021031 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * Contributer has declined to give copyright information, and gives * it freely to the world. */ #include "mp4common.h" MP4TextAtom::MP4TextAtom() : MP4Atom("text") { // The atom type "text" is used in two complete unrelated ways // i.e. it's real two atoms with the same name // To handle that we need to postpone property creation until // we know who our parent atom is (stsd or gmhd) which gives us // the context info we need to know who we are } void MP4TextAtom::AddPropertiesStsdType() { AddReserved("reserved1", 6); /* 0 */ AddProperty(new MP4Integer16Property("dataReferenceIndex"));/* 1 */ AddProperty(new MP4Integer32Property("displayFlags")); /* 2 */ AddProperty(new MP4Integer32Property("textJustification")); /* 3 */ AddProperty(new MP4Integer16Property("bgColorRed")); /* 4 */ AddProperty(new MP4Integer16Property("bgColorGreen")); /* 5 */ AddProperty(new MP4Integer16Property("bgColorBlue")); /* 6 */ AddProperty(new MP4Integer16Property("defTextBoxTop")); /* 7 */ AddProperty(new MP4Integer16Property("defTextBoxLeft")); /* 8 */ AddProperty(new MP4Integer16Property("defTextBoxBottom")); /* 9 */ AddProperty(new MP4Integer16Property("defTextBoxRight")); /* 10 */ AddReserved("reserved2", 8); /* 11 */ AddProperty(new MP4Integer16Property("fontNumber")); /* 12 */ AddProperty(new MP4Integer16Property("fontFace")); /* 13 */ AddReserved("reserved3", 1); /* 14 */ AddReserved("reserved4", 2); /* 15 */ AddProperty(new MP4Integer16Property("foreColorRed")); /* 16 */ AddProperty(new MP4Integer16Property("foreColorGreen")); /* 17 */ AddProperty(new MP4Integer16Property("foreColorBlue")); /* 18 */ } void MP4TextAtom::AddPropertiesGmhdType() { AddProperty(new MP4BytesProperty("textData", 36)); /* 0 */ } void MP4TextAtom::Generate() { if (ATOMID(m_pParentAtom->GetType()) == ATOMID("stsd")) { AddPropertiesStsdType(); GenerateStsdType(); } else if (ATOMID(m_pParentAtom->GetType()) == ATOMID("gmhd")) { AddPropertiesGmhdType(); GenerateGmhdType(); } else { VERBOSE_WARNING(m_pFile->GetVerbosity(), printf("Warning: text atom in unexpected context, can not generate")); } } void MP4TextAtom::GenerateStsdType() { // generate children MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); ((MP4Integer32Property*)m_pProperties[2])->SetValue(1); ((MP4Integer32Property*)m_pProperties[3])->SetValue(1); } void MP4TextAtom::GenerateGmhdType() { MP4Atom::Generate(); // property 0 has non-zero fixed values static u_int8_t textData[36] = { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, }; ((MP4BytesProperty*)m_pProperties[0])->SetValue(textData, sizeof(textData)); } void MP4TextAtom::Read () { if (ATOMID(m_pParentAtom->GetType()) == ATOMID("stsd")) { AddPropertiesStsdType(); } else if (ATOMID(m_pParentAtom->GetType()) == ATOMID("gmhd")) { AddPropertiesGmhdType(); } MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_tfhd.cpp0000644010307701030770000000335710101411050020744 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4TfhdAtom::MP4TfhdAtom() : MP4Atom("tfhd") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("trackId")); } void MP4TfhdAtom::AddProperties(u_int32_t flags) { if (flags & 0x01) { // note this property is signed 64! AddProperty( new MP4Integer64Property("baseDataOffset")); } if (flags & 0x02) { AddProperty( new MP4Integer32Property("sampleDescriptionIndex")); } if (flags & 0x08) { AddProperty( new MP4Integer32Property("defaultSampleDuration")); } if (flags & 0x10) { AddProperty( new MP4Integer32Property("defaultSampleSize")); } if (flags & 0x20) { AddProperty( new MP4Integer32Property("defaultSampleFlags")); } } void MP4TfhdAtom::Read() { /* read atom version, flags, and trackId */ ReadProperties(0, 3); /* need to create the properties based on the atom flags */ AddProperties(GetFlags()); /* now we can read the remaining properties */ ReadProperties(3); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_tkhd.cpp0000644010307701030770000000650511136736372021001 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4TkhdAtom::MP4TkhdAtom() : MP4Atom("tkhd") { AddVersionAndFlags(); } void MP4TkhdAtom::AddProperties(u_int8_t version) { if (version == 1) { AddProperty( /* 2 */ new MP4Integer64Property("creationTime")); AddProperty( /* 3 */ new MP4Integer64Property("modificationTime")); } else { // version == 0 AddProperty( /* 2 */ new MP4Integer32Property("creationTime")); AddProperty( /* 3 */ new MP4Integer32Property("modificationTime")); } AddProperty( /* 4 */ new MP4Integer32Property("trackId")); AddReserved("reserved1", 4); /* 5 */ if (version == 1) { AddProperty( /* 6 */ new MP4Integer64Property("duration")); } else { AddProperty( /* 6 */ new MP4Integer32Property("duration")); } AddReserved("reserved2", 12); /* 7 */ MP4Float32Property* pProp; pProp = new MP4Float32Property("volume"); pProp->SetFixed16Format(); AddProperty(pProp); /* 8 */ AddReserved("reserved3", 2); /* 9 */ AddProperty(new MP4BytesProperty("matrix", 36)); /* 10 */ pProp = new MP4Float32Property("width"); pProp->SetFixed32Format(); AddProperty(pProp); /* 11 */ pProp = new MP4Float32Property("height"); pProp->SetFixed32Format(); AddProperty(pProp); /* 12 */ } void MP4TkhdAtom::Generate() { u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0; SetVersion(version); AddProperties(version); MP4Atom::Generate(); // set creation and modification times MP4Timestamp now = MP4GetAbsTimestamp(); if (version == 1) { ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); } else { ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); } // property "matrix" has non-zero fixed values // this default identity matrix indicates no transformation, i.e. // 1, 0, 0 // 0, 1, 0 // 0, 0, 1 // see http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap4/chapter_5_section_4.html static u_int8_t matrix[36] = { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, }; ((MP4BytesProperty*)m_pProperties[10])-> SetValue(matrix, sizeof(matrix)); } void MP4TkhdAtom::Read() { /* read atom version */ ReadProperties(0, 1); /* need to create the properties based on the atom version */ AddProperties(GetVersion()); /* now we can read the remaining properties */ ReadProperties(1); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_treftype.cpp0000644010307701030770000000267110101411050021657 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4TrefTypeAtom::MP4TrefTypeAtom(const char* type) : MP4Atom(type) { MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetImplicit(); AddProperty(pCount); /* 0 */ MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); /* 1 */ pTable->AddProperty( /* 1, 0 */ new MP4Integer32Property("trackId")); } void MP4TrefTypeAtom::Read() { // table entry count computed from atom size ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false); ((MP4Integer32Property*)m_pProperties[0])->SetValue(m_size / 4); ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true); MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_trun.cpp0000644010307701030770000000375411136736372021042 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4TrunAtom::MP4TrunAtom() : MP4Atom("trun") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sampleCount")); } void MP4TrunAtom::AddProperties(u_int32_t flags) { if (flags & 0x01) { // Note this is a signed 32 value AddProperty( new MP4Integer32Property("dataOffset")); } if (flags & 0x04) { AddProperty( new MP4Integer32Property("firstSampleFlags")); } MP4TableProperty* pTable = new MP4TableProperty("samples", (MP4Integer32Property *)m_pProperties[2]); AddProperty(pTable); if (flags & 0x100) { pTable->AddProperty( new MP4Integer32Property("sampleDuration")); } if (flags & 0x200) { pTable->AddProperty( new MP4Integer32Property("sampleSize")); } if (flags & 0x400) { pTable->AddProperty( new MP4Integer32Property("sampleFlags")); } if (flags & 0x800) { pTable->AddProperty( new MP4Integer32Property("sampleCompositionTimeOffset")); } } void MP4TrunAtom::Read() { /* read atom version, flags, and sampleCount */ ReadProperties(0, 3); /* need to create the properties based on the atom flags */ AddProperties(GetFlags()); /* now we can read the remaining properties */ ReadProperties(3); Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_udta.cpp0000644010307701030770000000254011136736372020777 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4UdtaAtom::MP4UdtaAtom() : MP4Atom("udta") { ExpectChildAtom("cprt", Optional, Many); ExpectChildAtom("hnti", Optional, OnlyOne); ExpectChildAtom("meta", Optional, OnlyOne); ExpectChildAtom("\251cpy", Optional, OnlyOne); ExpectChildAtom("\251des", Optional, OnlyOne); ExpectChildAtom("\251nam", Optional, OnlyOne); ExpectChildAtom("\251cmt", Optional, OnlyOne); ExpectChildAtom("\251prd", Optional, OnlyOne); } void MP4UdtaAtom::Read() { if (ATOMID(m_pParentAtom->GetType()) == ATOMID("trak")) { ExpectChildAtom("hinf", Optional, OnlyOne); } MP4Atom::Read(); } faac-1.28/common/mp4v2/atom_url.cpp0000644010307701030770000000313611136736372020646 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4UrlAtom::MP4UrlAtom(const char *type) : MP4Atom(type) { AddVersionAndFlags(); AddProperty(new MP4StringProperty("location")); } void MP4UrlAtom::Read() { // read the version and flags properties ReadProperties(0, 2); // check if self-contained flag is set if (!(GetFlags() & 1)) { // if not then read url location ReadProperties(2); } Skip(); // to end of atom } void MP4UrlAtom::Write() { MP4StringProperty* pLocationProp = (MP4StringProperty*)m_pProperties[2]; // if no url location has been set // then set self-contained flag // and don't attempt to write anything if (pLocationProp->GetValue() == NULL) { SetFlags(GetFlags() | 1); pLocationProp->SetImplicit(true); } else { SetFlags(GetFlags() & 0xFFFFFE); pLocationProp->SetImplicit(false); } // write atom as usual MP4Atom::Write(); } faac-1.28/common/mp4v2/atom_urn.cpp0000644010307701030770000000226310101411050020616 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4UrnAtom::MP4UrnAtom() : MP4Atom("urn ") { AddVersionAndFlags(); AddProperty(new MP4StringProperty("name")); AddProperty(new MP4StringProperty("location")); } void MP4UrnAtom::Read() { // read the version, flags, and name properties ReadProperties(0, 3); // check if location is present if (m_pFile->GetPosition() < GetEnd()) { // read it ReadProperties(3); } Skip(); // to end of atom } faac-1.28/common/mp4v2/atom_video.cpp0000644010307701030770000000422311136736372021150 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ #include "mp4common.h" MP4VideoAtom::MP4VideoAtom (const char *type) : MP4Atom(type) { AddReserved("reserved1", 6); /* 0 */ AddProperty( /* 1 */ new MP4Integer16Property("dataReferenceIndex")); AddReserved("reserved2", 16); /* 2 */ AddProperty( /* 3 */ new MP4Integer16Property("width")); AddProperty( /* 4 */ new MP4Integer16Property("height")); AddReserved("reserved3", 14); /* 5 */ MP4StringProperty* pProp = new MP4StringProperty("compressorName"); pProp->SetFixedLength(32); pProp->SetValue(""); AddProperty(pProp); /* 6 */ AddProperty(/* 7 */ new MP4Integer16Property("depth")); AddProperty(/* 8 */ new MP4Integer16Property("colorTableId")); ExpectChildAtom("smi ", Optional, OnlyOne); } void MP4VideoAtom::Generate() { MP4Atom::Generate(); ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); // property reserved3 has non-zero fixed values static u_int8_t reserved3[14] = { 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, }; m_pProperties[5]->SetReadOnly(false); ((MP4BytesProperty*)m_pProperties[5])-> SetValue(reserved3, sizeof(reserved3)); m_pProperties[5]->SetReadOnly(true); // depth and color table id values - should be set later // as far as depth - color table is most likely 0xff ((MP4IntegerProperty *)m_pProperties[7])->SetValue(0x18); ((MP4IntegerProperty *)m_pProperties[8])->SetValue(0xffff); } faac-1.28/common/mp4v2/atom_vmhd.cpp0000644010307701030770000000171210101411050020746 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4VmhdAtom::MP4VmhdAtom() : MP4Atom("vmhd") { AddVersionAndFlags(); AddReserved("reserved", 8); } void MP4VmhdAtom::Generate() { MP4Atom::Generate(); SetFlags(1); } faac-1.28/common/mp4v2/atoms.h0000644010307701030770000001660111136736372017615 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com * Bill May wmay@cisco.com */ #ifndef __MP4_ATOMS_INCLUDED__ #define __MP4_ATOMS_INCLUDED__ // declare all the atom subclasses // i.e. spare us atom_xxxx.h for all the atoms // // The majority of atoms just need their own constructor declared // Some atoms have a few special needs // A small minority of atoms need lots of special handling class MP4RootAtom : public MP4Atom { public: MP4RootAtom(); void BeginWrite(bool use64 = false); void Write(); void FinishWrite(bool use64 = false); void BeginOptimalWrite(); void FinishOptimalWrite(); protected: u_int32_t GetLastMdatIndex(); void WriteAtomType(const char* type, bool onlyOne); }; /*********************************************************************** * Common atom classes - standard for anything that just contains atoms * and non-maleable properties, treftype and url ***********************************************************************/ class MP4StandardAtom : public MP4Atom { public: MP4StandardAtom(const char *name); }; class MP4TrefTypeAtom : public MP4Atom { public: MP4TrefTypeAtom(const char* type); void Read(); }; class MP4UrlAtom : public MP4Atom { public: MP4UrlAtom(const char *type="url "); void Read(); void Write(); }; /*********************************************************************** * Sound and Video atoms - use the generic atoms when possible * (MP4SoundAtom and MP4VideoAtom) ***********************************************************************/ class MP4SoundAtom : public MP4Atom { public: MP4SoundAtom(const char *atomid); void Generate(); void Read(); protected: void AddProperties(u_int8_t version); }; class MP4VideoAtom : public MP4Atom { public: MP4VideoAtom(const char *atomid); void Generate(); }; class MP4AmrAtom : public MP4Atom { public: MP4AmrAtom(const char *type); void Generate(); }; // H.264 atoms class MP4Avc1Atom : public MP4Atom { public: MP4Avc1Atom(); void Generate(); }; class MP4AvcCAtom : public MP4Atom { public: MP4AvcCAtom(); void Generate(); void Clone(MP4AvcCAtom *dstAtom); }; class MP4D263Atom : public MP4Atom { public: MP4D263Atom(); void Generate(); void Write(); }; class MP4DamrAtom : public MP4Atom { public: MP4DamrAtom(); void Generate(); }; class MP4EncaAtom : public MP4Atom { public: MP4EncaAtom(); void Generate(); }; class MP4EncvAtom : public MP4Atom { public: MP4EncvAtom(); void Generate(); }; class MP4Mp4aAtom : public MP4Atom { public: MP4Mp4aAtom(); void Generate(); }; class MP4Mp4sAtom : public MP4Atom { public: MP4Mp4sAtom(); void Generate(); }; class MP4Mp4vAtom : public MP4Atom { public: MP4Mp4vAtom(); void Generate(); }; class MP4S263Atom : public MP4Atom { public: MP4S263Atom(); void Generate(); }; /************************************************************************ * Specialized Atoms ************************************************************************/ class MP4DataAtom : public MP4Atom { public: MP4DataAtom(); void Read(); }; class MP4DrefAtom : public MP4Atom { public: MP4DrefAtom(); void Read(); }; class MP4ElstAtom : public MP4Atom { public: MP4ElstAtom(); void Generate(); void Read(); protected: void AddProperties(u_int8_t version); }; class MP4FreeAtom : public MP4Atom { public: MP4FreeAtom(); void Read(); void Write(); }; class MP4FtypAtom : public MP4Atom { public: MP4FtypAtom(); void Generate(); void Read(); }; class MP4GminAtom : public MP4Atom { public: MP4GminAtom(); void Generate(); }; class MP4HdlrAtom : public MP4Atom { public: MP4HdlrAtom(); void Read(); }; class MP4HinfAtom : public MP4Atom { public: MP4HinfAtom(); void Generate(); }; class MP4HntiAtom : public MP4Atom { public: MP4HntiAtom(); void Read(); }; class MP4MdatAtom : public MP4Atom { public: MP4MdatAtom(); void Read(); void Write(); }; class MP4MdhdAtom : public MP4Atom { public: MP4MdhdAtom(); void Generate(); void Read(); protected: void AddProperties(u_int8_t version); }; class MP4Meta1Atom : public MP4Atom { public: MP4Meta1Atom(const char *name); void Read(); }; class MP4Meta2Atom : public MP4Atom { public: MP4Meta2Atom(const char *name); void Read(); }; class MP4MvhdAtom : public MP4Atom { public: MP4MvhdAtom(); void Generate(); void Read(); protected: void AddProperties(u_int8_t version); }; class MP4OhdrAtom : public MP4Atom { public: MP4OhdrAtom(); ~MP4OhdrAtom(); void Read(); }; class MP4RtpAtom : public MP4Atom { public: MP4RtpAtom(); void Generate(); void Read(); void Write(); protected: void AddPropertiesStsdType(); void AddPropertiesHntiType(); void GenerateStsdType(); void GenerateHntiType(); void ReadStsdType(); void ReadHntiType(); void WriteHntiType(); }; class MP4SdpAtom : public MP4Atom { public: MP4SdpAtom(); void Read(); void Write(); }; class MP4SmiAtom : public MP4Atom { public: MP4SmiAtom(void); void Read(); }; class MP4StblAtom : public MP4Atom { public: MP4StblAtom(); void Generate(); }; class MP4StdpAtom : public MP4Atom { public: MP4StdpAtom(); void Read(); }; class MP4StscAtom : public MP4Atom { public: MP4StscAtom(); void Read(); }; class MP4StsdAtom : public MP4Atom { public: MP4StsdAtom(); void Read(); }; class MP4StszAtom : public MP4Atom { public: MP4StszAtom(); void Read(); void Write(); }; class MP4Stz2Atom : public MP4Atom { public: MP4Stz2Atom(); void Read(); }; class MP4TextAtom : public MP4Atom { public: MP4TextAtom(); void Generate(); void Read(); protected: void AddPropertiesStsdType(); void AddPropertiesGmhdType(); void GenerateStsdType(); void GenerateGmhdType(); }; class MP4TfhdAtom : public MP4Atom { public: MP4TfhdAtom(); void Read(); protected: void AddProperties(u_int32_t flags); }; class MP4TkhdAtom : public MP4Atom { public: MP4TkhdAtom(); void Generate(); void Read(); protected: void AddProperties(u_int8_t version); }; class MP4TrunAtom : public MP4Atom { public: MP4TrunAtom(); void Read(); protected: void AddProperties(u_int32_t flags); }; class MP4UdtaAtom : public MP4Atom { public: MP4UdtaAtom(); void Read(); }; class MP4UrnAtom : public MP4Atom { public: MP4UrnAtom(); void Read(); }; class MP4VmhdAtom : public MP4Atom { public: MP4VmhdAtom(); void Generate(); }; class MP4HrefAtom : public MP4Atom { public: MP4HrefAtom(); void Generate(void); }; #endif /* __MP4_ATOMS_INCLUDED__ */ faac-1.28/common/mp4v2/descriptors.cpp0000644010307701030770000004155311136736372021372 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4BaseDescriptor::MP4BaseDescriptor (u_int8_t tag) : MP4Descriptor(tag) { switch (tag) { case MP4ESIDIncDescrTag: AddProperty( /* 0 */ new MP4Integer32Property("id")); break; case MP4ESIDRefDescrTag: AddProperty( /* 0 */ new MP4Integer16Property("refIndex")); break; case MP4IPIPtrDescrTag: AddProperty( /* 0 */ new MP4Integer16Property("IPIESId")); break; case MP4SupplContentIdDescrTag: AddProperty( /* 0 */ new MP4BytesProperty("languageCode", 3)); AddProperty( /* 1 */ new MP4StringProperty("title", Counted)); AddProperty( /* 2 */ new MP4StringProperty("value", Counted)); break; case MP4IPMPPtrDescrTag: AddProperty( /* 0 */ new MP4Integer8Property("IPMPDescriptorId")); break; case MP4ExtProfileLevelDescrTag: AddProperty( /* 0 */ new MP4Integer8Property("profileLevelIndicationIndex")); AddProperty( /* 1 */ new MP4Integer8Property("ODProfileLevelIndication")); AddProperty( /* 2 */ new MP4Integer8Property("sceneProfileLevelIndication")); AddProperty( /* 3 */ new MP4Integer8Property("audioProfileLevelIndication")); AddProperty( /* 4 */ new MP4Integer8Property("visualProfileLevelIndication")); AddProperty( /* 5 */ new MP4Integer8Property("graphicsProfileLevelIndication")); AddProperty( /* 6 */ new MP4Integer8Property("MPEGJProfileLevelIndication")); break; default: MP4Printf("error in base descriptor - tag %u", tag); break; } } MP4BytesDescriptor::MP4BytesDescriptor (u_int8_t tag) : MP4Descriptor(tag) { m_size_offset = 0; m_bytes_index = 0; if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) { AddProperty( /* 0 */ new MP4BytesProperty("data")); } else { switch (tag) { case MP4DecSpecificDescrTag: AddProperty( /* 0 */ new MP4BytesProperty("info")); // no change to m_size break; case MP4IPMPDescrTag: AddProperty( /* 0 */ new MP4Integer8Property("IPMPDescriptorId")); AddProperty( /* 1 */ new MP4Integer16Property("IPMPSType")); AddProperty( /* 2 */ new MP4BytesProperty("IPMPData")); /* note: if IPMPSType == 0, IPMPData is an URL */ m_size_offset = 3; m_bytes_index = 2; break; case MP4RegistrationDescrTag: AddProperty( /* 0 */ new MP4Integer32Property("formatIdentifier")); AddProperty( /* 1 */ new MP4BytesProperty("additionalIdentificationInfo")); m_size_offset = 4; m_bytes_index = 1; break; default: MP4Printf("error in bytes descriptor - tag %u", tag); break; } } } void MP4BytesDescriptor::Read(MP4File *pFile) { ReadHeader(pFile); /* byte properties need to know how long they are before reading */ ((MP4BytesProperty*)m_pProperties[m_bytes_index])->SetValueSize(m_size - m_size_offset); ReadProperties(pFile); } MP4IODescriptor::MP4IODescriptor() : MP4Descriptor(MP4FileIODescrTag) { /* N.B. other member functions depend on the property indicies */ AddProperty( /* 0 */ new MP4BitfieldProperty("objectDescriptorId", 10)); AddProperty( /* 1 */ new MP4BitfieldProperty("URLFlag", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("includeInlineProfileLevelFlag", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("reserved", 4)); AddProperty( /* 4 */ new MP4StringProperty("URL", Counted)); AddProperty( /* 5 */ new MP4Integer8Property("ODProfileLevelId")); AddProperty( /* 6 */ new MP4Integer8Property("sceneProfileLevelId")); AddProperty( /* 7 */ new MP4Integer8Property("audioProfileLevelId")); AddProperty( /* 8 */ new MP4Integer8Property("visualProfileLevelId")); AddProperty( /* 9 */ new MP4Integer8Property("graphicsProfileLevelId")); AddProperty( /* 10 */ new MP4DescriptorProperty("esIds", MP4ESIDIncDescrTag, 0, Required, Many)); AddProperty( /* 11 */ new MP4DescriptorProperty("ociDescr", MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many)); AddProperty( /* 12 */ new MP4DescriptorProperty("ipmpDescrPtr", MP4IPMPPtrDescrTag, 0, Optional, Many)); AddProperty( /* 13 */ new MP4DescriptorProperty("extDescr", MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); SetReadMutate(2); } void MP4IODescriptor::Generate() { ((MP4BitfieldProperty*)m_pProperties[0])->SetValue(1); ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(0xF); for (u_int32_t i = 5; i <= 9; i++) { ((MP4Integer8Property*)m_pProperties[i])->SetValue(0xFF); } } void MP4IODescriptor::Mutate() { bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); m_pProperties[4]->SetImplicit(!urlFlag); for (u_int32_t i = 5; i <= 12; i++) { m_pProperties[i]->SetImplicit(urlFlag); } } MP4ODescriptor::MP4ODescriptor() : MP4Descriptor(MP4FileODescrTag) { /* N.B. other member functions depend on the property indicies */ AddProperty( /* 0 */ new MP4BitfieldProperty("objectDescriptorId", 10)); AddProperty( /* 1 */ new MP4BitfieldProperty("URLFlag", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("reserved", 5)); AddProperty( /* 3 */ new MP4StringProperty("URL", Counted)); AddProperty( /* 4 */ new MP4DescriptorProperty("esIds", MP4ESIDRefDescrTag, 0, Required, Many)); AddProperty( /* 5 */ new MP4DescriptorProperty("ociDescr", MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many)); AddProperty( /* 6 */ new MP4DescriptorProperty("ipmpDescrPtr", MP4IPMPPtrDescrTag, 0, Optional, Many)); AddProperty( /* 7 */ new MP4DescriptorProperty("extDescr", MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); SetReadMutate(2); } void MP4ODescriptor::Generate() { ((MP4BitfieldProperty*)m_pProperties[2])->SetValue(0x1F); } void MP4ODescriptor::Mutate() { bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); m_pProperties[3]->SetImplicit(!urlFlag); for (u_int32_t i = 4; i <= 6; i++) { m_pProperties[i]->SetImplicit(urlFlag); } } MP4ESDescriptor::MP4ESDescriptor() : MP4Descriptor(MP4ESDescrTag) { /* N.B. other class functions depend on the property indicies */ AddProperty( /* 0 */ new MP4Integer16Property("ESID")); AddProperty( /* 1 */ new MP4BitfieldProperty("streamDependenceFlag", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("URLFlag", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("OCRstreamFlag", 1)); AddProperty( /* 4 */ new MP4BitfieldProperty("streamPriority", 5)); AddProperty( /* 5 */ new MP4Integer16Property("dependsOnESID")); AddProperty( /* 6 */ new MP4StringProperty("URL", Counted)); AddProperty( /* 7 */ new MP4Integer16Property("OCRESID")); AddProperty( /* 8 */ new MP4DescriptorProperty("decConfigDescr", MP4DecConfigDescrTag, 0, Required, OnlyOne)); AddProperty( /* 9 */ new MP4DescriptorProperty("slConfigDescr", MP4SLConfigDescrTag, 0, Required, OnlyOne)); AddProperty( /* 10 */ new MP4DescriptorProperty("ipiPtr", MP4IPIPtrDescrTag, 0, Optional, OnlyOne)); AddProperty( /* 11 */ new MP4DescriptorProperty("ipIds", MP4ContentIdDescrTag, MP4SupplContentIdDescrTag, Optional, Many)); AddProperty( /* 12 */ new MP4DescriptorProperty("ipmpDescrPtr", MP4IPMPPtrDescrTag, 0, Optional, Many)); AddProperty( /* 13 */ new MP4DescriptorProperty("langDescr", MP4LanguageDescrTag, 0, Optional, Many)); AddProperty( /* 14 */ new MP4DescriptorProperty("qosDescr", MP4QosDescrTag, 0, Optional, OnlyOne)); AddProperty( /* 15 */ new MP4DescriptorProperty("regDescr", MP4RegistrationDescrTag, 0, Optional, OnlyOne)); AddProperty( /* 16 */ new MP4DescriptorProperty("extDescr", MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); SetReadMutate(5); } void MP4ESDescriptor::Mutate() { bool streamDependFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); m_pProperties[5]->SetImplicit(!streamDependFlag); bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); m_pProperties[6]->SetImplicit(!urlFlag); bool ocrFlag = ((MP4BitfieldProperty*)m_pProperties[3])->GetValue(); m_pProperties[7]->SetImplicit(!ocrFlag); } MP4DecConfigDescriptor::MP4DecConfigDescriptor() : MP4Descriptor(MP4DecConfigDescrTag) { AddProperty( /* 0 */ new MP4Integer8Property("objectTypeId")); AddProperty( /* 1 */ new MP4BitfieldProperty("streamType", 6)); AddProperty( /* 2 */ new MP4BitfieldProperty("upStream", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("reserved", 1)); AddProperty( /* 4 */ new MP4BitfieldProperty("bufferSizeDB", 24)); AddProperty( /* 5 */ new MP4Integer32Property("maxBitrate")); AddProperty( /* 6 */ new MP4Integer32Property("avgBitrate")); AddProperty( /* 7 */ new MP4DescriptorProperty("decSpecificInfo", MP4DecSpecificDescrTag, 0, Optional, OnlyOne)); AddProperty( /* 8 */ new MP4DescriptorProperty("profileLevelIndicationIndexDescr", MP4ExtProfileLevelDescrTag, 0, Optional, Many)); } void MP4DecConfigDescriptor::Generate() { ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(1); } MP4SLConfigDescriptor::MP4SLConfigDescriptor() : MP4Descriptor(MP4SLConfigDescrTag) { AddProperty( /* 0 */ new MP4Integer8Property("predefined")); AddProperty( /* 1 */ new MP4BitfieldProperty("useAccessUnitStartFlag", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("useAccessUnitEndFlag", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("useRandomAccessPointFlag", 1)); AddProperty( /* 4 */ new MP4BitfieldProperty("hasRandomAccessUnitsOnlyFlag", 1)); AddProperty( /* 5 */ new MP4BitfieldProperty("usePaddingFlag", 1)); AddProperty( /* 6 */ new MP4BitfieldProperty("useTimeStampsFlag", 1)); AddProperty( /* 7 */ new MP4BitfieldProperty("useIdleFlag", 1)); AddProperty( /* 8 */ new MP4BitfieldProperty("durationFlag", 1)); AddProperty( /* 9 */ new MP4Integer32Property("timeStampResolution")); AddProperty( /* 10 */ new MP4Integer32Property("OCRResolution")); AddProperty( /* 11 */ new MP4Integer8Property("timeStampLength")); AddProperty( /* 12 */ new MP4Integer8Property("OCRLength")); AddProperty( /* 13 */ new MP4Integer8Property("AULength")); AddProperty( /* 14 */ new MP4Integer8Property("instantBitrateLength")); AddProperty( /* 15 */ new MP4BitfieldProperty("degradationPriortyLength", 4)); AddProperty( /* 16 */ new MP4BitfieldProperty("AUSeqNumLength", 5)); AddProperty( /* 17 */ new MP4BitfieldProperty("packetSeqNumLength", 5)); AddProperty( /* 18 */ new MP4BitfieldProperty("reserved", 2)); // if durationFlag AddProperty( /* 19 */ new MP4Integer32Property("timeScale")); AddProperty( /* 20 */ new MP4Integer16Property("accessUnitDuration")); AddProperty( /* 21 */ new MP4Integer16Property("compositionUnitDuration")); // if !useTimeStampsFlag AddProperty( /* 22 */ new MP4BitfieldProperty("startDecodingTimeStamp", 64)); AddProperty( /* 23 */ new MP4BitfieldProperty("startCompositionTimeStamp", 64)); } void MP4SLConfigDescriptor::Generate() { // by default all tracks in an mp4 file // use predefined SLConfig descriptor == 2 ((MP4Integer8Property*)m_pProperties[0])->SetValue(2); // which implies UseTimestampsFlag = 1 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1); // reserved = 3 ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3); } void MP4SLConfigDescriptor::Read(MP4File* pFile) { ReadHeader(pFile); // read the first property, 'predefined' ReadProperties(pFile, 0, 1); // if predefined == 0 if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) { /* read the next 18 properties */ ReadProperties(pFile, 1, 18); } // now mutate Mutate(); // and read the remaining properties ReadProperties(pFile, 19); } void MP4SLConfigDescriptor::Mutate() { u_int32_t i; u_int8_t predefined = ((MP4Integer8Property*)m_pProperties[0])->GetValue(); if (predefined) { // properties 1-18 are implicit for (i = 1; i < m_pProperties.Size(); i++) { m_pProperties[i]->SetImplicit(true); } if (predefined == 1) { // UseTimestampsFlag = 0 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0); // TimestampResolution = 1000 ((MP4Integer32Property*)m_pProperties[9])->SetValue(1000); // TimeStampLength = 32 ((MP4Integer8Property*)m_pProperties[11])->SetValue(32); } else if (predefined == 2) { // UseTimestampsFlag = 1 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1); } } else { #if 1 for (i = 1; i <= 18; i++) { m_pProperties[i]->SetImplicit(false); } ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3); #endif } bool durationFlag = ((MP4BitfieldProperty*)m_pProperties[8])->GetValue(); for (i = 19; i <= 21; i++) { m_pProperties[i]->SetImplicit(!durationFlag); } bool useTimeStampsFlag = ((MP4BitfieldProperty*)m_pProperties[6])->GetValue(); for (i = 22; i <= 23; i++) { m_pProperties[i]->SetImplicit(useTimeStampsFlag); u_int8_t timeStampLength = MIN(64, ((MP4Integer8Property*)m_pProperties[11])->GetValue()); ((MP4BitfieldProperty*)m_pProperties[i])->SetNumBits(timeStampLength); // handle a nonsensical situation gracefully if (timeStampLength == 0) { m_pProperties[i]->SetImplicit(true); } } } MP4ContentIdDescriptor::MP4ContentIdDescriptor() : MP4Descriptor(MP4ContentIdDescrTag) { AddProperty( /* 0 */ new MP4BitfieldProperty("compatibility", 2)); AddProperty( /* 1 */ new MP4BitfieldProperty("contentTypeFlag", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("contentIdFlag", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("protectedContent", 1)); AddProperty( /* 4 */ new MP4BitfieldProperty("reserved", 3)); AddProperty( /* 5 */ new MP4Integer8Property("contentType")); AddProperty( /* 6 */ new MP4Integer8Property("contentIdType")); AddProperty( /* 7 */ new MP4BytesProperty("contentId")); } void MP4ContentIdDescriptor::Read(MP4File* pFile) { ReadHeader(pFile); /* read the first property, 'compatiblity' */ ReadProperties(pFile, 0, 1); /* if compatiblity != 0 */ if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) { /* we don't understand it */ VERBOSE_READ(pFile->GetVerbosity(), printf("incompatible content id descriptor\n")); return; } /* read the next four properties */ ReadProperties(pFile, 1, 4); /* which allows us to reconfigure ourselves */ Mutate(); bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); if (contentIdFlag) { u_int32_t cIdOffset = 2; if (contentTypeFlag) { cIdOffset++; } ((MP4BytesProperty*)m_pProperties[7])->SetValueSize(m_size - cIdOffset); } /* read the remaining properties */ ReadProperties(pFile, 5); } void MP4ContentIdDescriptor::Mutate() { bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); m_pProperties[5]->SetImplicit(!contentTypeFlag); bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); m_pProperties[6]->SetImplicit(!contentIdFlag); m_pProperties[7]->SetImplicit(!contentIdFlag); } MP4Descriptor* MP4DescriptorProperty::CreateDescriptor(u_int8_t tag) { MP4Descriptor* pDescriptor = NULL; switch (tag) { case MP4ESDescrTag: pDescriptor = new MP4ESDescriptor(); break; case MP4DecConfigDescrTag: pDescriptor = new MP4DecConfigDescriptor(); break; case MP4DecSpecificDescrTag: case MP4IPMPDescrTag: case MP4RegistrationDescrTag: pDescriptor = new MP4BytesDescriptor(tag); break; case MP4SLConfigDescrTag: pDescriptor = new MP4SLConfigDescriptor(); break; case MP4ContentIdDescrTag: pDescriptor = new MP4ContentIdDescriptor(); break; case MP4ESIDIncDescrTag: case MP4ESIDRefDescrTag: case MP4IPIPtrDescrTag: case MP4SupplContentIdDescrTag: case MP4IPMPPtrDescrTag: case MP4ExtProfileLevelDescrTag: pDescriptor = new MP4BaseDescriptor(tag); break; case MP4QosDescrTag: pDescriptor = new MP4QosDescriptorBase(MP4QosDescrTag); break; case MP4IODescrTag: case MP4FileIODescrTag: pDescriptor = new MP4IODescriptor(); pDescriptor->SetTag(tag); break; case MP4ODescrTag: case MP4FileODescrTag: pDescriptor = new MP4ODescriptor(); pDescriptor->SetTag(tag); break; } if (pDescriptor == NULL) { if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) { pDescriptor = CreateOCIDescriptor(tag); } if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) { pDescriptor = new MP4BytesDescriptor(tag); } } return pDescriptor; } faac-1.28/common/mp4v2/descriptors.h0000644010307701030770000000710111136736372021026 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __DESCRIPTORS_INCLUDED__ #define __DESCRIPTORS_INCLUDED__ const u_int8_t MP4ODescrTag = 0x01; const u_int8_t MP4IODescrTag = 0x02; const u_int8_t MP4ESDescrTag = 0x03; const u_int8_t MP4DecConfigDescrTag = 0x04; const u_int8_t MP4DecSpecificDescrTag = 0x05; const u_int8_t MP4SLConfigDescrTag = 0x06; const u_int8_t MP4ContentIdDescrTag = 0x07; const u_int8_t MP4SupplContentIdDescrTag = 0x08; const u_int8_t MP4IPIPtrDescrTag = 0x09; const u_int8_t MP4IPMPPtrDescrTag = 0x0A; const u_int8_t MP4IPMPDescrTag = 0x0B; const u_int8_t MP4RegistrationDescrTag = 0x0D; const u_int8_t MP4ESIDIncDescrTag = 0x0E; const u_int8_t MP4ESIDRefDescrTag = 0x0F; const u_int8_t MP4FileIODescrTag = 0x10; const u_int8_t MP4FileODescrTag = 0x11; const u_int8_t MP4ExtProfileLevelDescrTag = 0x13; const u_int8_t MP4ExtDescrTagsStart = 0x80; const u_int8_t MP4ExtDescrTagsEnd = 0xFE; class MP4BaseDescriptor : public MP4Descriptor { public: MP4BaseDescriptor(u_int8_t tag); }; class MP4BytesDescriptor : public MP4Descriptor { public: MP4BytesDescriptor(u_int8_t tag); void Read(MP4File* pFile); protected: uint m_size_offset; // size to adjust the size for the bytes property uint m_bytes_index; // index into properties for bytes property }; class MP4IODescriptor : public MP4Descriptor { public: MP4IODescriptor(); void Generate(); protected: void Mutate(); }; class MP4ODescriptor : public MP4Descriptor { public: MP4ODescriptor(); void Generate(); protected: void Mutate(); }; class MP4ESDescriptor : public MP4Descriptor { public: MP4ESDescriptor(); protected: void Mutate(); }; class MP4DecConfigDescriptor : public MP4Descriptor { public: MP4DecConfigDescriptor(); void Generate(); }; class MP4SLConfigDescriptor : public MP4Descriptor { public: MP4SLConfigDescriptor(); void Generate(); void Read(MP4File* pFile); protected: void Mutate(); }; class MP4IPIPtrDescriptor : public MP4Descriptor { public: MP4IPIPtrDescriptor(); }; class MP4ContentIdDescriptor : public MP4Descriptor { public: MP4ContentIdDescriptor(); void Read(MP4File* pFile); protected: void Mutate(); }; // associated values in descriptors // ES objectTypeId const u_int8_t MP4SystemsV1ObjectType = 0x01; const u_int8_t MP4SystemsV2ObjectType = 0x02; // ES streamType const u_int8_t MP4ObjectDescriptionStreamType = 0x01; const u_int8_t MP4ClockReferenceStreamType = 0x02; const u_int8_t MP4SceneDescriptionStreamType = 0x03; const u_int8_t MP4VisualStreamType = 0x04; const u_int8_t MP4AudioStreamType = 0x05; const u_int8_t MP4Mpeg7StreamType = 0x06; const u_int8_t MP4IPMPStreamType = 0x07; const u_int8_t MP4OCIStreamType = 0x08; const u_int8_t MP4MPEGJStreamType = 0x09; const u_int8_t MP4UserPrivateStreamType = 0x20; #endif /* __DESCRIPTORS_INCLUDED__ */ faac-1.28/common/mp4v2/isma.cpp0000644010307701030770000006047111136736372017762 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" static const u_int8_t BifsV2Config[3] = { 0x00, 0x00, 0x60 // IsCommandStream = 1, PixelMetric = 1 }; void MP4File::MakeIsmaCompliant(bool addIsmaComplianceSdp) { ProtectWriteOperation("MP4MakeIsmaCompliant"); if (m_useIsma) { // already done return; } // find first audio and/or video tracks MP4TrackId audioTrackId = MP4_INVALID_TRACK_ID; try { audioTrackId = FindTrackId(0, MP4_AUDIO_TRACK_TYPE); } catch (MP4Error* e) { delete e; } MP4TrackId videoTrackId = MP4_INVALID_TRACK_ID; try { videoTrackId = FindTrackId(0, MP4_VIDEO_TRACK_TYPE); } catch (MP4Error* e) { delete e; } if (audioTrackId == MP4_INVALID_TRACK_ID && videoTrackId == MP4_INVALID_TRACK_ID) return; const char *audio_media_data_name, *video_media_data_name; uint8_t videoProfile = 0xff; if (audioTrackId != MP4_INVALID_TRACK_ID) { audio_media_data_name = MP4GetTrackMediaDataName(this, audioTrackId); if (!(ATOMID(audio_media_data_name) == ATOMID("mp4a") || ATOMID(audio_media_data_name) == ATOMID("enca"))) { VERBOSE_ERROR(m_verbosity, printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", audio_media_data_name); ); return; } } // // Note - might have to check for avc1 here... if (videoTrackId != MP4_INVALID_TRACK_ID) { video_media_data_name = MP4GetTrackMediaDataName(this, videoTrackId); if (!(ATOMID(video_media_data_name) == ATOMID("mp4v") || ATOMID(video_media_data_name) == ATOMID("encv"))) { VERBOSE_ERROR(m_verbosity, printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", video_media_data_name); ); return; } uint32_t verb = GetVerbosity(); SetVerbosity(verb & ~MP4_DETAILS_ERROR); videoProfile = MP4GetVideoProfileLevel(this, videoTrackId); SetVerbosity(verb); } m_useIsma = true; u_int64_t fileMsDuration = 0; fileMsDuration = ConvertFromMovieDuration(GetDuration(), MP4_MSECS_TIME_SCALE); // delete any existing OD track if (m_odTrackId != MP4_INVALID_TRACK_ID) { DeleteTrack(m_odTrackId); } if (m_pRootAtom->FindAtom("moov.iods") == NULL) { (void)AddChildAtom("moov", "iods"); } (void)AddODTrack(); SetODProfileLevel(0xFF); if (audioTrackId != MP4_INVALID_TRACK_ID) { AddTrackToOd(audioTrackId); MP4SetAudioProfileLevel(this, 0xf); } if (videoTrackId != MP4_INVALID_TRACK_ID) { AddTrackToOd(videoTrackId); MP4SetVideoProfileLevel(this, videoProfile); } // delete any existing scene track MP4TrackId sceneTrackId = MP4_INVALID_TRACK_ID; try { sceneTrackId = FindTrackId(0, MP4_SCENE_TRACK_TYPE); } catch (MP4Error *e) { delete e; } if (sceneTrackId != MP4_INVALID_TRACK_ID) { DeleteTrack(sceneTrackId); } // add scene track sceneTrackId = AddSceneTrack(); SetSceneProfileLevel(0xFF); SetGraphicsProfileLevel(0xFF); SetTrackIntegerProperty(sceneTrackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", MP4SystemsV2ObjectType); SetTrackESConfiguration(sceneTrackId, BifsV2Config, sizeof(BifsV2Config)); u_int8_t* pBytes = NULL; u_int64_t numBytes = 0; // write OD Update Command CreateIsmaODUpdateCommandFromFileForFile( m_odTrackId, audioTrackId, videoTrackId, &pBytes, &numBytes); WriteSample(m_odTrackId, pBytes, numBytes, fileMsDuration); MP4Free(pBytes); pBytes = NULL; // write BIFS Scene Replace Command CreateIsmaSceneCommand( MP4_IS_VALID_TRACK_ID(audioTrackId), MP4_IS_VALID_TRACK_ID(videoTrackId), &pBytes, &numBytes); WriteSample(sceneTrackId, pBytes, numBytes, fileMsDuration); MP4Free(pBytes); pBytes = NULL; // add session level sdp CreateIsmaIodFromFile( m_odTrackId, sceneTrackId, audioTrackId, videoTrackId, &pBytes, &numBytes); char* iodBase64 = MP4ToBase64(pBytes, numBytes); uint sdpBufLen = strlen(iodBase64) + 256; uint used; char* sdpBuf = (char*)MP4Calloc(sdpBufLen); if (addIsmaComplianceSdp) { strncpy(sdpBuf, "a=isma-compliance:1,1.0,1\015\012", sdpBufLen); } used = strlen(sdpBuf); sdpBufLen -= used; snprintf(&sdpBuf[used], sdpBufLen, "a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042\015\012", iodBase64); SetSessionSdp(sdpBuf); VERBOSE_ISMA(GetVerbosity(), printf("IOD SDP = %s\n", sdpBuf)); MP4Free(iodBase64); iodBase64 = NULL; MP4Free(pBytes); pBytes = NULL; MP4Free(sdpBuf); sdpBuf = NULL; } static void CloneIntegerProperty( MP4Descriptor* pDest, MP4DescriptorProperty* pSrc, const char* name) { MP4IntegerProperty* pGetProperty; MP4IntegerProperty* pSetProperty; if (!pSrc->FindProperty(name, (MP4Property**)&pGetProperty)) return; if (!pDest->FindProperty(name, (MP4Property**)&pSetProperty)) return; pSetProperty->SetValue(pGetProperty->GetValue()); } void MP4File::CreateIsmaIodFromFile( MP4TrackId odTrackId, MP4TrackId sceneTrackId, MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4Descriptor* pIod = new MP4IODescriptor(); pIod->SetTag(MP4IODescrTag); pIod->Generate(); MP4Atom* pIodsAtom = FindAtom("moov.iods"); ASSERT(pIodsAtom); MP4DescriptorProperty* pSrcIod = (MP4DescriptorProperty*)pIodsAtom->GetProperty(2); CloneIntegerProperty(pIod, pSrcIod, "objectDescriptorId"); CloneIntegerProperty(pIod, pSrcIod, "ODProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "sceneProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "audioProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "visualProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "graphicsProfileLevelId"); // mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag MP4DescriptorProperty* pEsProperty; if (!pIod->FindProperty("esIds", (MP4Property**)&pEsProperty)) return; pEsProperty->SetTags(MP4ESDescrTag); MP4IntegerProperty* pSetProperty; MP4IntegerProperty* pSceneESID; MP4IntegerProperty* pOdESID; // OD MP4Descriptor* pOdEsd = pEsProperty->AddDescriptor(MP4ESDescrTag); pOdEsd->Generate(); if (!pOdEsd->FindProperty("ESID", (MP4Property**)&pOdESID)) return; // we set the OD ESID to a non-zero unique value pOdESID->SetValue(m_odTrackId); if (pOdEsd->FindProperty("URLFlag", (MP4Property**)&pSetProperty)) pSetProperty->SetValue(1); u_int8_t* pBytes; u_int64_t numBytes; CreateIsmaODUpdateCommandFromFileForStream( audioTrackId, videoTrackId, &pBytes, &numBytes); VERBOSE_ISMA(GetVerbosity(), printf("OD data =\n"); MP4HexDump(pBytes, numBytes)); char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); uint urlBufLen = strlen(odCmdBase64) + 64; char* urlBuf = (char*)MP4Malloc(urlBufLen); snprintf(urlBuf, urlBufLen, "data:application/mpeg4-od-au;base64,%s", odCmdBase64); MP4StringProperty* pUrlProperty; if (pOdEsd->FindProperty("URL", (MP4Property**)&pUrlProperty)) pUrlProperty->SetValue(urlBuf); VERBOSE_ISMA(GetVerbosity(), printf("OD data URL = \042%s\042\n", urlBuf)); MP4Free(odCmdBase64); odCmdBase64 = NULL; MP4Free(pBytes); pBytes = NULL; MP4Free(urlBuf); urlBuf = NULL; MP4DescriptorProperty* pSrcDcd = NULL; // HACK temporarily point to scene decoder config (void)FindProperty(MakeTrackName(odTrackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), (MP4Property**)&pSrcDcd); ASSERT(pSrcDcd); MP4Property* pOrgOdEsdProperty = pOdEsd->GetProperty(8); pOdEsd->SetProperty(8, pSrcDcd); // bufferSizeDB needs to be set appropriately MP4BitfieldProperty* pBufferSizeProperty = NULL; if (pOdEsd->FindProperty("decConfigDescr.bufferSizeDB", (MP4Property**)&pBufferSizeProperty)) { ASSERT(pBufferSizeProperty); pBufferSizeProperty->SetValue(numBytes); } // SL config needs to change from 2 (file) to 1 (null) if (pOdEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pSetProperty)) pSetProperty->SetValue(1); // Scene MP4Descriptor* pSceneEsd = pEsProperty->AddDescriptor(MP4ESDescrTag); pSceneEsd->Generate(); if (pSceneEsd->FindProperty("ESID", (MP4Property**)&pSceneESID)) { // we set the Scene ESID to a non-zero unique value pSceneESID->SetValue(sceneTrackId); } if (pSceneEsd->FindProperty("URLFlag", (MP4Property**)&pSetProperty)) pSetProperty->SetValue(1); CreateIsmaSceneCommand( MP4_IS_VALID_TRACK_ID(audioTrackId), MP4_IS_VALID_TRACK_ID(videoTrackId), &pBytes, &numBytes); VERBOSE_ISMA(GetVerbosity(), printf("Scene data =\n"); MP4HexDump(pBytes, numBytes)); char *sceneCmdBase64 = MP4ToBase64(pBytes, numBytes); urlBuf = (char*)MP4Malloc(strlen(sceneCmdBase64) + 64); snprintf(urlBuf, strlen(sceneCmdBase64) + 64, "data:application/mpeg4-bifs-au;base64,%s", sceneCmdBase64); if (pSceneEsd->FindProperty("URL", (MP4Property**)&pUrlProperty)) pUrlProperty->SetValue(urlBuf); VERBOSE_ISMA(GetVerbosity(), printf("Scene data URL = \042%s\042\n", urlBuf)); MP4Free(sceneCmdBase64); sceneCmdBase64 = NULL; MP4Free(urlBuf); urlBuf = NULL; MP4Free(pBytes); pBytes = NULL; // HACK temporarily point to scene decoder config ASSERT(FindProperty(MakeTrackName(sceneTrackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), (MP4Property**)&pSrcDcd)); ASSERT(pSrcDcd); MP4Property* pOrgSceneEsdProperty = pSceneEsd->GetProperty(8); pSceneEsd->SetProperty(8, pSrcDcd); // bufferSizeDB needs to be set pBufferSizeProperty = NULL; if (pSceneEsd->FindProperty("decConfigDescr.bufferSizeDB", (MP4Property**)&pBufferSizeProperty)) { ASSERT(pBufferSizeProperty); pBufferSizeProperty->SetValue(numBytes); } // SL config needs to change from 2 (file) to 1 (null) if (pSceneEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pSetProperty)) pSetProperty->SetValue(1); // finally get the whole thing written to a memory pIod->WriteToMemory(this, ppBytes, pNumBytes); // now carefully replace esd properties before destroying pOdEsd->SetProperty(8, pOrgOdEsdProperty); pSceneEsd->SetProperty(8, pOrgSceneEsdProperty); pSceneESID->SetValue(0); // restore 0 value pOdESID->SetValue(0); delete pIod; VERBOSE_ISMA(GetVerbosity(), printf("IOD data =\n"); MP4HexDump(*ppBytes, *pNumBytes)); } void MP4File::CreateIsmaIodFromParams( u_int8_t videoProfile, u_int32_t videoBitrate, u_int8_t* videoConfig, u_int32_t videoConfigLength, u_int8_t audioProfile, u_int32_t audioBitrate, u_int8_t* audioConfig, u_int32_t audioConfigLength, u_int8_t** ppIodBytes, u_int64_t* pIodNumBytes) { MP4IntegerProperty* pInt; u_int8_t* pBytes = NULL; u_int64_t numBytes; // Create the IOD MP4Descriptor* pIod = new MP4IODescriptor(); pIod->SetTag(MP4IODescrTag); pIod->Generate(); // Set audio and video profileLevels if (pIod->FindProperty("audioProfileLevelId", (MP4Property**)&pInt)) pInt->SetValue(audioProfile); if (pIod->FindProperty("visualProfileLevelId", (MP4Property**)&pInt)) pInt->SetValue(videoProfile); // Mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag MP4DescriptorProperty* pEsProperty; if (!pIod->FindProperty("esIds", (MP4Property**)&pEsProperty)) return; pEsProperty->SetTags(MP4ESDescrTag); // Add ES Descriptors // Scene CreateIsmaSceneCommand( (audioProfile != 0xFF), (videoProfile != 0xFF), &pBytes, &numBytes); VERBOSE_ISMA(GetVerbosity(), printf("Scene data =\n"); MP4HexDump(pBytes, numBytes)); char* sceneCmdBase64 = MP4ToBase64(pBytes, numBytes); char* urlBuf = (char*)MP4Malloc(strlen(sceneCmdBase64) + 64); snprintf(urlBuf, strlen(sceneCmdBase64) + 64, "data:application/mpeg4-bifs-au;base64,%s", sceneCmdBase64); VERBOSE_ISMA(GetVerbosity(), printf("Scene data URL = \042%s\042\n", urlBuf)); /* MP4Descriptor* pSceneEsd = */ CreateESD( pEsProperty, 201, // esid MP4SystemsV2ObjectType, MP4SceneDescriptionStreamType, numBytes, // bufferSize numBytes * 8, // bitrate BifsV2Config, sizeof(BifsV2Config), urlBuf); MP4Free(urlBuf); urlBuf = NULL; MP4Free(sceneCmdBase64); sceneCmdBase64 = NULL; MP4Free(pBytes); pBytes = NULL; // OD // Video MP4DescriptorProperty* pVideoEsdProperty = new MP4DescriptorProperty(); pVideoEsdProperty->SetTags(MP4ESDescrTag); /* MP4Descriptor* pVideoEsd = */ CreateESD( pVideoEsdProperty, 20, // esid MP4_MPEG4_VIDEO_TYPE, MP4VisualStreamType, videoBitrate / 8, // bufferSize videoBitrate, videoConfig, videoConfigLength, NULL); // Audio MP4DescriptorProperty* pAudioEsdProperty = new MP4DescriptorProperty(); pAudioEsdProperty->SetTags(MP4ESDescrTag); /* MP4Descriptor* pAudioEsd = */ CreateESD( pAudioEsdProperty, 10, // esid MP4_MPEG4_AUDIO_TYPE, MP4AudioStreamType, audioBitrate / 8, // bufferSize audioBitrate, audioConfig, audioConfigLength, NULL); CreateIsmaODUpdateCommandForStream( pAudioEsdProperty, pVideoEsdProperty, &pBytes, &numBytes); // cleanup temporary descriptor properties delete pAudioEsdProperty; delete pVideoEsdProperty; VERBOSE_ISMA(GetVerbosity(), printf("OD data = "U64" bytes\n", numBytes); MP4HexDump(pBytes, numBytes)); char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64); if (urlBuf != NULL) { snprintf(urlBuf, strlen(odCmdBase64) + 64, "data:application/mpeg4-od-au;base64,%s", odCmdBase64); VERBOSE_ISMA(GetVerbosity(), printf("OD data URL = \042%s\042\n", urlBuf)); /* MP4Descriptor* pOdEsd = */ CreateESD( pEsProperty, 101, MP4SystemsV1ObjectType, MP4ObjectDescriptionStreamType, numBytes, // bufferSize numBytes * 8, // bitrate NULL, // config 0, // configLength urlBuf); MP4Free(urlBuf); urlBuf = NULL; } MP4Free(odCmdBase64); odCmdBase64 = NULL; MP4Free(pBytes); pBytes = NULL; // finally get the whole thing written to a memory pIod->WriteToMemory(this, ppIodBytes, pIodNumBytes); delete pIod; VERBOSE_ISMA(GetVerbosity(), printf("IOD data =\n"); MP4HexDump(*ppIodBytes, *pIodNumBytes)); } void MP4File::CreateESD( MP4DescriptorProperty* pEsProperty, u_int32_t esid, u_int8_t objectType, u_int8_t streamType, u_int32_t bufferSize, u_int32_t bitrate, const u_int8_t* pConfig, u_int32_t configLength, char* url) { MP4IntegerProperty* pInt; MP4StringProperty* pString; MP4BytesProperty* pBytes; MP4BitfieldProperty* pBits; MP4Descriptor* pEsd = pEsProperty->AddDescriptor(MP4ESDescrTag); pEsd->Generate(); if (pEsd->FindProperty("ESID", (MP4Property**)&pInt)) pInt->SetValue(esid); if (pEsd->FindProperty("decConfigDescr.objectTypeId", (MP4Property**)&pInt)) pInt->SetValue(objectType); if (pEsd->FindProperty("decConfigDescr.streamType", (MP4Property**)&pInt)) pInt->SetValue(streamType); if (pEsd->FindProperty("decConfigDescr.bufferSizeDB", (MP4Property**)&pInt)) pInt->SetValue(bufferSize); if (pEsd->FindProperty("decConfigDescr.maxBitrate", (MP4Property**)&pInt)) pInt->SetValue(bitrate); if (pEsd->FindProperty("decConfigDescr.avgBitrate", (MP4Property**)&pInt)) pInt->SetValue(bitrate); MP4DescriptorProperty* pConfigDescrProperty; if (pEsd->FindProperty("decConfigDescr.decSpecificInfo", (MP4Property**)&pConfigDescrProperty)) { MP4Descriptor* pConfigDescr = pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag); pConfigDescr->Generate(); if (pConfigDescrProperty->FindProperty("decSpecificInfo[0].info", (MP4Property**)&pBytes)) pBytes->SetValue(pConfig, configLength); } if (pEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pInt)) // changed 12/5/02 from plugfest to value 0 pInt->SetValue(0); if (pEsd->FindProperty("slConfig.useAccessUnitEndFlag", (MP4Property **)&pBits)) pBits->SetValue(1); if (url) { if (pEsd->FindProperty("URLFlag", (MP4Property**)&pInt)) pInt->SetValue(1); if (pEsd->FindProperty("URL", (MP4Property**)&pString)) pString->SetValue(url); } //return pEsd; } void MP4File::CreateIsmaODUpdateCommandFromFileForFile( MP4TrackId odTrackId, MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4Descriptor* pCommand = CreateODCommand(MP4ODUpdateODCommandTag); pCommand->Generate(); for (u_int8_t i = 0; i < 2; i++) { MP4TrackId trackId; u_int16_t odId; if (i == 0) { trackId = audioTrackId; odId = 10; } else { trackId = videoTrackId; odId = 20; } if (trackId == MP4_INVALID_TRACK_ID) { continue; } MP4DescriptorProperty* pOdDescrProperty = (MP4DescriptorProperty*)(pCommand->GetProperty(0)); pOdDescrProperty->SetTags(MP4FileODescrTag); MP4Descriptor* pOd = pOdDescrProperty->AddDescriptor(MP4FileODescrTag); pOd->Generate(); MP4BitfieldProperty* pOdIdProperty = NULL; if (pOd->FindProperty("objectDescriptorId", (MP4Property**)&pOdIdProperty)) pOdIdProperty->SetValue(odId); MP4DescriptorProperty* pEsIdsDescriptorProperty = NULL; ASSERT(pOd->FindProperty("esIds", (MP4Property**)&pEsIdsDescriptorProperty)); ASSERT(pEsIdsDescriptorProperty); pEsIdsDescriptorProperty->SetTags(MP4ESIDRefDescrTag); MP4Descriptor *pRefDescriptor = pEsIdsDescriptorProperty->AddDescriptor(MP4ESIDRefDescrTag); pRefDescriptor->Generate(); MP4Integer16Property* pRefIndexProperty = NULL; ASSERT(pRefDescriptor->FindProperty("refIndex", (MP4Property**)&pRefIndexProperty)); ASSERT(pRefIndexProperty); u_int32_t mpodIndex = FindTrackReference( MakeTrackName(odTrackId, "tref.mpod"), trackId); ASSERT(mpodIndex != 0); pRefIndexProperty->SetValue(mpodIndex); } pCommand->WriteToMemory(this, ppBytes, pNumBytes); delete pCommand; } void MP4File::CreateIsmaODUpdateCommandFromFileForStream( MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4DescriptorProperty* pAudioEsd = NULL; MP4Integer8Property* pAudioSLConfigPredef = NULL; MP4BitfieldProperty* pAudioAccessUnitEndFlag = NULL; int oldAudioUnitEndFlagValue = 0; MP4DescriptorProperty* pVideoEsd = NULL; MP4Integer8Property* pVideoSLConfigPredef = NULL; MP4BitfieldProperty* pVideoAccessUnitEndFlag = NULL; int oldVideoUnitEndFlagValue = 0; MP4IntegerProperty* pAudioEsdId = NULL; MP4IntegerProperty* pVideoEsdId = NULL; if (audioTrackId != MP4_INVALID_TRACK_ID) { // changed mp4a to * to handle enca case MP4Atom* pEsdsAtom = FindAtom(MakeTrackName(audioTrackId, "mdia.minf.stbl.stsd.*.esds")); ASSERT(pEsdsAtom); pAudioEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); // ESID is 0 for file, stream needs to be non-ze ASSERT(pAudioEsd->FindProperty("ESID", (MP4Property**)&pAudioEsdId)); ASSERT(pAudioEsdId); pAudioEsdId->SetValue(audioTrackId); // SL config needs to change from 2 (file) to 1 (null) if (pAudioEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pAudioSLConfigPredef)) { ASSERT(pAudioSLConfigPredef); pAudioSLConfigPredef->SetValue(0); } if (pAudioEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", (MP4Property **)&pAudioAccessUnitEndFlag)) { oldAudioUnitEndFlagValue = pAudioAccessUnitEndFlag->GetValue(); pAudioAccessUnitEndFlag->SetValue(1); } } if (videoTrackId != MP4_INVALID_TRACK_ID) { // changed mp4v to * to handle encv case MP4Atom* pEsdsAtom = FindAtom(MakeTrackName(videoTrackId, "mdia.minf.stbl.stsd.*.esds")); ASSERT(pEsdsAtom); pVideoEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); ASSERT(pVideoEsd->FindProperty("ESID", (MP4Property**)&pVideoEsdId)); ASSERT(pVideoEsdId); pVideoEsdId->SetValue(videoTrackId); // SL config needs to change from 2 (file) to 1 (null) ASSERT(pVideoEsd->FindProperty("slConfigDescr.predefined", (MP4Property **)&pVideoSLConfigPredef)); ASSERT(pVideoSLConfigPredef); pVideoSLConfigPredef->SetValue(0); if (pVideoEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", (MP4Property **)&pVideoAccessUnitEndFlag)) { oldVideoUnitEndFlagValue = pVideoAccessUnitEndFlag->GetValue(); pVideoAccessUnitEndFlag->SetValue(1); } } CreateIsmaODUpdateCommandForStream( pAudioEsd, pVideoEsd, ppBytes, pNumBytes); VERBOSE_ISMA(GetVerbosity(), printf("After CreateImsaODUpdateCommandForStream len "U64" =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes)); // return SL config values to 2 (file) // return ESID values to 0 if (pAudioSLConfigPredef) { pAudioSLConfigPredef->SetValue(2); } if (pAudioEsdId) { pAudioEsdId->SetValue(0); } if (pAudioAccessUnitEndFlag) { pAudioAccessUnitEndFlag->SetValue(oldAudioUnitEndFlagValue ); } if (pVideoEsdId) { pVideoEsdId->SetValue(0); } if (pVideoSLConfigPredef) { pVideoSLConfigPredef->SetValue(2); } if (pVideoAccessUnitEndFlag) { pVideoAccessUnitEndFlag->SetValue(oldVideoUnitEndFlagValue ); } } void MP4File::CreateIsmaODUpdateCommandForStream( MP4DescriptorProperty* pAudioEsdProperty, MP4DescriptorProperty* pVideoEsdProperty, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4Descriptor* pAudioOd = NULL; MP4Descriptor* pVideoOd = NULL; MP4Descriptor* pCommand = CreateODCommand(MP4ODUpdateODCommandTag); pCommand->Generate(); for (u_int8_t i = 0; i < 2; i++) { u_int16_t odId; MP4DescriptorProperty* pEsdProperty = NULL; if (i == 0) { odId = 10; pEsdProperty = pAudioEsdProperty; } else { odId = 20; pEsdProperty = pVideoEsdProperty; } if (pEsdProperty == NULL) { continue; } MP4DescriptorProperty* pOdDescrProperty = (MP4DescriptorProperty*)(pCommand->GetProperty(0)); pOdDescrProperty->SetTags(MP4ODescrTag); MP4Descriptor* pOd = pOdDescrProperty->AddDescriptor(MP4ODescrTag); pOd->Generate(); if (i == 0) { pAudioOd = pOd; } else { pVideoOd = pOd; } MP4BitfieldProperty* pOdIdProperty = NULL; if (pOd->FindProperty("objectDescriptorId", (MP4Property**)&pOdIdProperty)) { pOdIdProperty->SetValue(odId); } delete (MP4DescriptorProperty*)pOd->GetProperty(4); pOd->SetProperty(4, pEsdProperty); } // serialize OD command pCommand->WriteToMemory(this, ppBytes, pNumBytes); // detach from esd descriptor params if (pAudioOd) { pAudioOd->SetProperty(4, NULL); } if (pVideoOd) { pVideoOd->SetProperty(4, NULL); } // then destroy delete pCommand; } void MP4File::CreateIsmaSceneCommand( bool hasAudio, bool hasVideo, u_int8_t** ppBytes, u_int64_t* pNumBytes) { // from ISMA 1.0 Tech Spec Appendix E static const u_int8_t bifsAudioOnly[] = { 0xC0, 0x10, 0x12, 0x81, 0x30, 0x2A, 0x05, 0x6D, 0xC0 }; static const u_int8_t bifsVideoOnly[] = { 0xC0, 0x10, 0x12, 0x61, 0x04, 0x1F, 0xC0, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x00, 0x44, 0x28, 0x22, 0x82, 0x9F, 0x80 }; static const u_int8_t bifsAudioVideo[] = { 0xC0, 0x10, 0x12, 0x81, 0x30, 0x2A, 0x05, 0x6D, 0x26, 0x10, 0x41, 0xFC, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x04, 0x42, 0x82, 0x28, 0x29, 0xF8 }; if (hasAudio && hasVideo) { *pNumBytes = sizeof(bifsAudioVideo); *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); memcpy(*ppBytes, bifsAudioVideo, sizeof(bifsAudioVideo)); } else if (hasAudio) { *pNumBytes = sizeof(bifsAudioOnly); *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); memcpy(*ppBytes, bifsAudioOnly, sizeof(bifsAudioOnly)); } else if (hasVideo) { *pNumBytes = sizeof(bifsVideoOnly); *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); memcpy(*ppBytes, bifsVideoOnly, sizeof(bifsVideoOnly)); } else { *pNumBytes = 0; *ppBytes = NULL; } } faac-1.28/common/mp4v2/libmp4v2_st60.vcproj0000644010307701030770000007245111136736372022066 0ustar fabian-guestfabian-guest faac-1.28/common/mp4v2/mp4.cpp0000644010307701030770000026314511136736372017534 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com * Bill May wmay@cisco.com */ /* * MP4 library API functions * * These are wrapper functions that provide C linkage conventions * to the library, and catch any internal errors, ensuring that * a proper return value is given. */ #include "mp4common.h" #define PRINT_ERROR(e) \ VERBOSE_ERROR(((MP4File*)hFile)->GetVerbosity(), e->Print()); /* file operations */ // benski> extern "C" MP4FileHandle MP4ReadEx (const char* fileName, void *user, struct Virtual_IO *virtual_IO, u_int32_t verbosity) { MP4File* pFile = NULL; try { pFile = new MP4File(verbosity); pFile->ReadEx(fileName, user, virtual_IO); return (MP4FileHandle)pFile; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; delete pFile; return MP4_INVALID_FILE_HANDLE; } } extern "C" MP4FileHandle MP4Read(const char* fileName, u_int32_t verbosity) { MP4File* pFile = NULL; try { pFile = new MP4File(verbosity); pFile->Read(fileName); return (MP4FileHandle)pFile; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; delete pFile; return MP4_INVALID_FILE_HANDLE; } } extern "C" MP4FileHandle MP4Create (const char* fileName, u_int32_t verbosity, u_int32_t flags) { return MP4CreateEx(fileName, verbosity, flags); } extern "C" MP4FileHandle MP4CreateEx (const char* fileName, u_int32_t verbosity, u_int32_t flags, int add_ftyp, int add_iods, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount) { MP4File* pFile = NULL; try { pFile = new MP4File(verbosity); // LATER useExtensibleFormat, moov first, then mvex's pFile->Create(fileName, flags, add_ftyp, add_iods, majorBrand, minorVersion, supportedBrands, supportedBrandsCount); return (MP4FileHandle)pFile; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; delete pFile; return MP4_INVALID_FILE_HANDLE; } } extern "C" MP4FileHandle MP4Modify(const char* fileName, u_int32_t verbosity, u_int32_t flags) { MP4File* pFile = NULL; try { pFile = new MP4File(verbosity); // LATER useExtensibleFormat, moov first, then mvex's if (pFile->Modify(fileName)) return (MP4FileHandle)pFile; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; } if (pFile) delete pFile; return MP4_INVALID_FILE_HANDLE; } extern "C" bool MP4Optimize(const char* existingFileName, const char* newFileName, u_int32_t verbosity) { try { MP4File* pFile = new MP4File(verbosity); pFile->Optimize(existingFileName, newFileName); delete pFile; return true; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; } return false; } extern "C" void MP4Close(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->Close(); delete (MP4File*)hFile; return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return ; } extern "C" bool MP4Dump( MP4FileHandle hFile, FILE* pDumpFile, bool dumpImplicits) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->Dump(pDumpFile, dumpImplicits); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } /* specific file properties */ extern "C" u_int32_t MP4GetVerbosity(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetVerbosity(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" void MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetVerbosity(verbosity); return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" MP4Duration MP4GetDuration(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetDuration(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" u_int32_t MP4GetTimeScale(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTimeScale(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTimeScale(value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetODProfileLevel(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetODProfileLevel(value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSceneProfileLevel(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetSceneProfileLevel(value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetVideoProfileLevel(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } if (MP4_IS_VALID_TRACK_ID(trackId)) { uint8_t *foo; uint32_t bufsize; uint8_t type; // for mpeg4 video tracks, try to look for the VOSH header, // which has this info. type = MP4GetTrackEsdsObjectTypeId(hFile, trackId); if (type == MP4_MPEG4_VIDEO_TYPE) { if (MP4GetTrackESConfiguration(hFile, trackId, &foo, &bufsize)) { uint8_t *ptr = foo; while (bufsize > 0) { if (htonl(*(uint32_t *)ptr) == 0x1b0) { uint8_t ret = ptr[4]; free(foo); return ret; } ptr++; bufsize--; } free(foo); } } } } return 0; } extern "C" void MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetVideoProfileLevel(value); return ; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return ; } extern "C" u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetAudioProfileLevel(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" void MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetAudioProfileLevel(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetGraphicsProfileLevel(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetGraphicsProfileLevel(value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } /* generic file properties */ extern "C" bool MP4HaveAtom (MP4FileHandle hFile, const char *atomName) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File *)hFile)->FindAtom(atomName) != NULL; } catch (MP4Error *e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetIntegerProperty( MP4FileHandle hFile, const char* propName, u_int64_t *retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetIntegerProperty(propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetFloatProperty( MP4FileHandle hFile, const char* propName, float *retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetFloatProperty(propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetStringProperty( MP4FileHandle hFile, const char* propName, const char **retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetStringProperty(propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetBytesProperty( MP4FileHandle hFile, const char* propName, u_int8_t** ppValue, u_int32_t* pValueSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetBytesProperty(propName, ppValue, pValueSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *ppValue = NULL; *pValueSize = 0; return false; } extern "C" bool MP4SetIntegerProperty( MP4FileHandle hFile, const char* propName, int64_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetIntegerProperty(propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetFloatProperty( MP4FileHandle hFile, const char* propName, float value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetFloatProperty(propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetStringProperty( MP4FileHandle hFile, const char* propName, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetStringProperty(propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetBytesProperty( MP4FileHandle hFile, const char* propName, const u_int8_t* pValue, u_int32_t valueSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetBytesProperty(propName, pValue, valueSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } /* track operations */ extern "C" MP4TrackId MP4AddTrack( MP4FileHandle hFile, const char* type) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddSystemsTrack(type); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddSystemsTrack( MP4FileHandle hFile, const char* type) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddSystemsTrack(type); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddODTrack(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddODTrack(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddSceneTrack(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddSceneTrack(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddAudioTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> AddAudioTrack(timeScale, sampleDuration, audioType); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } // // API to initialize ismacryp properties to sensible defaults. // if the input pointer is null then an ismacryp params is malloc'd. // caller must see to it that it is properly disposed of. // extern "C" mp4v2_ismacrypParams *MP4DefaultISMACrypParams(mp4v2_ismacrypParams *ptr) { try { if (ptr == NULL) { ptr = (mp4v2_ismacrypParams *)MP4Malloc(sizeof(mp4v2_ismacrypParams)); } memset(ptr, 0, sizeof(*ptr)); return ptr; } catch (...) { return MP4_INVALID_TRACK_ID; } } extern "C" MP4TrackId MP4AddEncAudioTrack(MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, mp4v2_ismacrypParams *icPp, u_int8_t audioType) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { if (icPp == NULL) { return ((MP4File*)hFile)-> AddEncAudioTrack(timeScale, sampleDuration, audioType, 0, 0, 0, 0, false, NULL, false); } else { return ((MP4File*)hFile)-> AddEncAudioTrack(timeScale, sampleDuration, audioType, icPp->scheme_type, icPp->scheme_version, icPp->key_ind_len, icPp->iv_len, icPp->selective_enc, icPp->kms_uri, true); } } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddAmrAudioTrack( MP4FileHandle hFile, u_int32_t timeScale, u_int16_t modeSet, u_int8_t modeChangePeriod, u_int8_t framesPerSample, bool isAmrWB) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> AddAmrAudioTrack(timeScale, modeSet, modeChangePeriod, framesPerSample, isAmrWB); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" void MP4SetAmrVendor( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t vendor) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetAmrVendor(trackId, vendor); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" void MP4SetAmrDecoderVersion( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t decoderVersion) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetAmrDecoderVersion(trackId, decoderVersion); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" void MP4SetAmrModeSet( MP4FileHandle hFile, MP4TrackId trackId, u_int16_t modeSet) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetAmrModeSet(trackId, modeSet); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" uint16_t MP4GetAmrModeSet( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> GetAmrModeSet(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" MP4TrackId MP4AddHrefTrack (MP4FileHandle hFile, uint32_t timeScale, MP4Duration sampleDuration, const char *base_url) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4File *pFile = (MP4File *)hFile; return pFile->AddHrefTrack(timeScale, sampleDuration, base_url); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" const char *MP4GetHrefTrackBaseUrl (MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackStringProperty(trackId, "mdia.minf.stbl.stsd.href.burl.base_url"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return NULL; } extern "C" MP4TrackId MP4AddVideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4File *pFile = (MP4File *)hFile; return pFile->AddMP4VideoTrack(timeScale, sampleDuration, width, height, videoType); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddEncVideoTrack(MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, mp4v2_ismacrypParams *icPp, u_int8_t videoType, const char *oFormat) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { // test for valid ismacrypt session descriptor if (icPp == NULL) { return MP4_INVALID_TRACK_ID; } MP4File *pFile = (MP4File *)hFile; return pFile->AddEncVideoTrack(timeScale, sampleDuration, width, height, videoType, icPp, oFormat); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddH264VideoTrack(MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, uint8_t AVCProfileIndication, uint8_t profile_compat, uint8_t AVCLevelIndication, uint8_t sampleLenFieldSizeMinusOne) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4File *pFile = (MP4File *)hFile; return pFile->AddH264VideoTrack(timeScale, sampleDuration, width, height, AVCProfileIndication, profile_compat, AVCLevelIndication, sampleLenFieldSizeMinusOne); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddEncH264VideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp ) { MP4Atom *srcAtom; MP4File *pFile; if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { pFile = (MP4File *)srcFile; srcAtom = pFile->FindTrackAtom(srcTrackId, "mdia.minf.stbl.stsd.avc1.avcC"); if (srcAtom == NULL) return MP4_INVALID_TRACK_ID; pFile = (MP4File *)hFile; return pFile->AddEncH264VideoTrack(timeScale, sampleDuration, width, height, srcAtom, icPp); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" void MP4AddH264SequenceParameterSet (MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pSequence, uint16_t sequenceLen) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4File *pFile = (MP4File *)hFile; pFile->AddH264SequenceParameterSet(trackId, pSequence, sequenceLen); return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" void MP4AddH264PictureParameterSet (MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pPict, uint16_t pictLen) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4File *pFile = (MP4File *)hFile; pFile->AddH264PictureParameterSet(trackId, pPict, pictLen); return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" MP4TrackId MP4AddH263VideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t h263Level, u_int8_t h263Profile, u_int32_t avgBitrate, u_int32_t maxBitrate) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> AddH263VideoTrack(timeScale, sampleDuration, width, height, h263Level, h263Profile, avgBitrate, maxBitrate); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" void MP4SetH263Vendor( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t vendor) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetH263Vendor(trackId, vendor); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" void MP4SetH263DecoderVersion( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t decoderVersion) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetH263DecoderVersion(trackId, decoderVersion); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" void MP4SetH263Bitrates( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t avgBitrate, u_int32_t maxBitrate) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)-> SetH263Bitrates(trackId, avgBitrate, maxBitrate); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } } extern "C" MP4TrackId MP4AddHintTrack( MP4FileHandle hFile, MP4TrackId refTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddHintTrack(refTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddTextTrack( MP4FileHandle hFile, MP4TrackId refTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddTextTrack(refTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4AddChapterTextTrack( MP4FileHandle hFile, MP4TrackId refTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->AddChapterTextTrack(refTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" MP4TrackId MP4CloneTrack (MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4FileHandle dstFile, MP4TrackId dstHintTrackReferenceTrack) { MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID; if (dstFile == NULL) { dstFile = srcFile; } const char* trackType = MP4GetTrackType(srcFile, srcTrackId); if (!trackType) { return dstTrackId; } const char *media_data_name = MP4GetTrackMediaDataName(srcFile, srcTrackId); if (media_data_name == NULL) return dstTrackId; if (MP4_IS_VIDEO_TRACK_TYPE(trackType)) { if (ATOMID(media_data_name) == ATOMID("mp4v")) { MP4SetVideoProfileLevel(dstFile, MP4GetVideoProfileLevel(srcFile)); dstTrackId = MP4AddVideoTrack( dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), MP4GetTrackVideoWidth(srcFile, srcTrackId), MP4GetTrackVideoHeight(srcFile, srcTrackId), MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId)); } else if (ATOMID(media_data_name) == ATOMID("avc1")) { uint8_t AVCProfileIndication; uint8_t profile_compat; uint8_t AVCLevelIndication; uint32_t sampleLenFieldSizeMinusOne; uint64_t temp; if (MP4GetTrackH264ProfileLevel(srcFile, srcTrackId, &AVCProfileIndication, &AVCLevelIndication) == false) { return dstTrackId; } if (MP4GetTrackH264LengthSize(srcFile, srcTrackId, &sampleLenFieldSizeMinusOne) == false) { return dstTrackId; } sampleLenFieldSizeMinusOne--; if (MP4GetTrackIntegerProperty(srcFile, srcTrackId, "mdia.minf.stbl.stsd.*[0].avcC.profile_compatibility", &temp) == false) return dstTrackId; profile_compat = temp & 0xff; dstTrackId = MP4AddH264VideoTrack(dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), MP4GetTrackVideoWidth(srcFile, srcTrackId), MP4GetTrackVideoHeight(srcFile, srcTrackId), AVCProfileIndication, profile_compat, AVCLevelIndication, sampleLenFieldSizeMinusOne); uint8_t **seqheader, **pictheader; uint32_t *pictheadersize, *seqheadersize; uint32_t ix; MP4GetTrackH264SeqPictHeaders(srcFile, srcTrackId, &seqheader, &seqheadersize, &pictheader, &pictheadersize); for (ix = 0; seqheadersize[ix] != 0; ix++) { MP4AddH264SequenceParameterSet(dstFile, dstTrackId, seqheader[ix], seqheadersize[ix]); free(seqheader[ix]); } free(seqheader); free(seqheadersize); for (ix = 0; pictheadersize[ix] != 0; ix++) { MP4AddH264PictureParameterSet(dstFile, dstTrackId, pictheader[ix], pictheadersize[ix]); free(pictheader[ix]); } free(pictheader); free(pictheadersize); } else return dstTrackId; } else if (MP4_IS_AUDIO_TRACK_TYPE(trackType)) { if (ATOMID(media_data_name) != ATOMID("mp4a")) return dstTrackId; MP4SetAudioProfileLevel(dstFile, MP4GetAudioProfileLevel(srcFile)); dstTrackId = MP4AddAudioTrack( dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId)); } else if (MP4_IS_OD_TRACK_TYPE(trackType)) { dstTrackId = MP4AddODTrack(dstFile); } else if (MP4_IS_SCENE_TRACK_TYPE(trackType)) { dstTrackId = MP4AddSceneTrack(dstFile); } else if (MP4_IS_HINT_TRACK_TYPE(trackType)) { if (dstHintTrackReferenceTrack == MP4_INVALID_TRACK_ID) { dstTrackId = MP4_INVALID_TRACK_ID; } else { dstTrackId = MP4AddHintTrack( dstFile, dstHintTrackReferenceTrack); } } else if (MP4_IS_SYSTEMS_TRACK_TYPE(trackType)) { dstTrackId = MP4AddSystemsTrack(dstFile, trackType); } else { dstTrackId = MP4AddTrack(dstFile, trackType); } if (dstTrackId == MP4_INVALID_TRACK_ID) { return dstTrackId; } MP4SetTrackTimeScale( dstFile, dstTrackId, MP4GetTrackTimeScale(srcFile, srcTrackId)); if (MP4_IS_AUDIO_TRACK_TYPE(trackType) || MP4_IS_VIDEO_TRACK_TYPE(trackType)) { // copy track ES configuration u_int8_t* pConfig = NULL; u_int32_t configSize = 0; uint32_t verb = MP4GetVerbosity(srcFile); MP4SetVerbosity(srcFile, verb & ~(MP4_DETAILS_ERROR)); bool haveEs = MP4GetTrackESConfiguration(srcFile, srcTrackId, &pConfig, &configSize); MP4SetVerbosity(srcFile, verb); if (haveEs && pConfig != NULL && configSize != 0) { if (!MP4SetTrackESConfiguration( dstFile, dstTrackId, pConfig, configSize)) { free(pConfig); MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } free(pConfig); } } if (MP4_IS_HINT_TRACK_TYPE(trackType)) { // probably not exactly what is wanted // but caller can adjust later to fit their desires char* payloadName = NULL; char *encodingParms = NULL; u_int8_t payloadNumber; u_int16_t maxPayloadSize; if (MP4GetHintTrackRtpPayload( srcFile, srcTrackId, &payloadName, &payloadNumber, &maxPayloadSize, &encodingParms)) { if (MP4SetHintTrackRtpPayload( dstFile, dstTrackId, payloadName, &payloadNumber, maxPayloadSize, encodingParms) == false) { MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } } #if 0 MP4SetHintTrackSdp( dstFile, dstTrackId, MP4GetHintTrackSdp(srcFile, srcTrackId)); #endif } return dstTrackId; } // Given a track, make an encrypted clone of it in the dest. file extern "C" MP4TrackId MP4EncAndCloneTrack(MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp, MP4FileHandle dstFile, MP4TrackId dstHintTrackReferenceTrack ) { const char *oFormat; MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID; if (dstFile == NULL) { dstFile = srcFile; } const char* trackType = MP4GetTrackType(srcFile, srcTrackId); if (!trackType) { return dstTrackId; } if (MP4_IS_VIDEO_TRACK_TYPE(trackType)) { // test source file format for avc1 oFormat = MP4GetTrackMediaDataName(srcFile, srcTrackId); if (!strcasecmp(oFormat, "avc1")) { dstTrackId = MP4AddEncH264VideoTrack(dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), MP4GetTrackVideoWidth(srcFile, srcTrackId), MP4GetTrackVideoHeight(srcFile, srcTrackId), srcFile, srcTrackId, icPp ); } else { MP4SetVideoProfileLevel(dstFile, MP4GetVideoProfileLevel(srcFile)); dstTrackId = MP4AddEncVideoTrack(dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), MP4GetTrackVideoWidth(srcFile, srcTrackId), MP4GetTrackVideoHeight(srcFile, srcTrackId), icPp, MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId), oFormat ); } } else if (MP4_IS_AUDIO_TRACK_TYPE(trackType)) { MP4SetAudioProfileLevel(dstFile, MP4GetAudioProfileLevel(srcFile)); dstTrackId = MP4AddEncAudioTrack(dstFile, MP4GetTrackTimeScale(srcFile, srcTrackId), MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), icPp, MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId) ); } else if (MP4_IS_OD_TRACK_TYPE(trackType)) { dstTrackId = MP4AddODTrack(dstFile); } else if (MP4_IS_SCENE_TRACK_TYPE(trackType)) { dstTrackId = MP4AddSceneTrack(dstFile); } else if (MP4_IS_HINT_TRACK_TYPE(trackType)) { if (dstHintTrackReferenceTrack == MP4_INVALID_TRACK_ID) { dstTrackId = MP4_INVALID_TRACK_ID; } else { dstTrackId = MP4AddHintTrack(dstFile, MP4GetHintTrackReferenceTrackId(srcFile, srcTrackId)); } } else if (MP4_IS_SYSTEMS_TRACK_TYPE(trackType)) { dstTrackId = MP4AddSystemsTrack(dstFile, trackType); } else { dstTrackId = MP4AddTrack(dstFile, trackType); } if (dstTrackId == MP4_INVALID_TRACK_ID) { return dstTrackId; } MP4SetTrackTimeScale(dstFile, dstTrackId, MP4GetTrackTimeScale(srcFile, srcTrackId)); if (MP4_IS_AUDIO_TRACK_TYPE(trackType) || MP4_IS_VIDEO_TRACK_TYPE(trackType)) { // copy track ES configuration u_int8_t* pConfig = NULL; u_int32_t configSize = 0; if (MP4GetTrackESConfiguration(srcFile, srcTrackId, &pConfig, &configSize)) { if (pConfig != NULL) { MP4SetTrackESConfiguration(dstFile, dstTrackId, pConfig, configSize); } } if (pConfig != NULL) free(pConfig); } // Bill's change to MP4CloneTrack if (MP4_IS_HINT_TRACK_TYPE(trackType)) { // probably not exactly what is wanted // but caller can adjust later to fit their desires char* payloadName = NULL; char *encodingParms = NULL; u_int8_t payloadNumber; u_int16_t maxPayloadSize; if (MP4GetHintTrackRtpPayload( srcFile, srcTrackId, &payloadName, &payloadNumber, &maxPayloadSize, &encodingParms)) { (void)MP4SetHintTrackRtpPayload( dstFile, dstTrackId, payloadName, &payloadNumber, maxPayloadSize, encodingParms); } #if 0 MP4SetHintTrackSdp( dstFile, dstTrackId, MP4GetHintTrackSdp(srcFile, srcTrackId)); #endif } return dstTrackId; } extern "C" MP4TrackId MP4CopyTrack(MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4FileHandle dstFile, bool applyEdits, MP4TrackId dstHintTrackReferenceTrack) { bool copySamples = true; // LATER allow false => reference samples MP4TrackId dstTrackId = MP4CloneTrack(srcFile, srcTrackId, dstFile, dstHintTrackReferenceTrack); if (dstTrackId == MP4_INVALID_TRACK_ID) { return dstTrackId; } bool viaEdits = applyEdits && MP4GetTrackNumberOfEdits(srcFile, srcTrackId); MP4SampleId sampleId = 0; MP4SampleId numSamples = MP4GetTrackNumberOfSamples(srcFile, srcTrackId); MP4Timestamp when = 0; MP4Duration editsDuration = MP4GetTrackEditTotalDuration(srcFile, srcTrackId); while (true) { MP4Duration sampleDuration = MP4_INVALID_DURATION; if (viaEdits) { sampleId = MP4GetSampleIdFromEditTime( srcFile, srcTrackId, when, NULL, &sampleDuration); // in theory, this shouldn't happen if (sampleId == MP4_INVALID_SAMPLE_ID) { MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } when += sampleDuration; if (when >= editsDuration) { break; } } else { sampleId++; if (sampleId > numSamples) { break; } } bool rc = false; if (copySamples) { rc = MP4CopySample( srcFile, srcTrackId, sampleId, dstFile, dstTrackId, sampleDuration); } else { rc = MP4ReferenceSample( srcFile, srcTrackId, sampleId, dstFile, dstTrackId, sampleDuration); } if (!rc) { MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } } return dstTrackId; } // Given a source track in a source file, make an encrypted copy of // the track in the destination file, including sample encryption extern "C" MP4TrackId MP4EncAndCopyTrack(MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp, encryptFunc_t encfcnp, u_int32_t encfcnparam1, MP4FileHandle dstFile, bool applyEdits, MP4TrackId dstHintTrackReferenceTrack ) { bool copySamples = true; // LATER allow false => reference samples MP4TrackId dstTrackId = MP4EncAndCloneTrack(srcFile, srcTrackId, icPp, dstFile, dstHintTrackReferenceTrack); if (dstTrackId == MP4_INVALID_TRACK_ID) { return dstTrackId; } bool viaEdits = applyEdits && MP4GetTrackNumberOfEdits(srcFile, srcTrackId); MP4SampleId sampleId = 0; MP4SampleId numSamples = MP4GetTrackNumberOfSamples(srcFile, srcTrackId); MP4Timestamp when = 0; MP4Duration editsDuration = MP4GetTrackEditTotalDuration(srcFile, srcTrackId); while (true) { MP4Duration sampleDuration = MP4_INVALID_DURATION; if (viaEdits) { sampleId = MP4GetSampleIdFromEditTime(srcFile, srcTrackId, when, NULL, &sampleDuration); // in theory, this shouldn't happen if (sampleId == MP4_INVALID_SAMPLE_ID) { MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } when += sampleDuration; if (when >= editsDuration) { break; } } else { sampleId++; if (sampleId > numSamples) { break; } } bool rc = false; if (copySamples) { // encrypt and copy rc = MP4EncAndCopySample(srcFile, srcTrackId, sampleId, encfcnp, encfcnparam1, dstFile, dstTrackId, sampleDuration); } else { // not sure what these are - encrypt? rc = MP4ReferenceSample(srcFile, srcTrackId, sampleId, dstFile, dstTrackId, sampleDuration); } if (!rc) { MP4DeleteTrack(dstFile, dstTrackId); return MP4_INVALID_TRACK_ID; } } return dstTrackId; } extern "C" void MP4DeleteTrack( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->DeleteTrack(trackId); return ; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" u_int32_t MP4GetNumberOfTracks( MP4FileHandle hFile, const char* type, u_int8_t subType) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetNumberOfTracks(type, subType); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" MP4TrackId MP4FindTrackId( MP4FileHandle hFile, u_int16_t index, const char* type, u_int8_t subType) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->FindTrackId(index, type, subType); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" u_int16_t MP4FindTrackIndex( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->FindTrackIndex(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return (u_int16_t)-1; } /* specific track properties */ extern "C" const char* MP4GetTrackType( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackType(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return NULL; } extern "C" const char* MP4GetTrackMediaDataName( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackMediaDataName(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return NULL; } extern "C" bool MP4GetTrackMediaDataOriginalFormat( MP4FileHandle hFile, MP4TrackId trackId, char *originalFormat, u_int32_t buflen) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackMediaDataOriginalFormat(trackId, originalFormat, buflen); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" MP4Duration MP4GetTrackDuration( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackDuration(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" u_int32_t MP4GetTrackTimeScale( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackTimeScale(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" void MP4SetTrackTimeScale( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackTimeScale(trackId, value); return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" u_int8_t MP4GetTrackAudioMpeg4Type( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackAudioMpeg4Type(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_MPEG4_INVALID_AUDIO_TYPE; } // Replacement to MP4GetTrackVideoType and MP4GetTrackAudioType // Basically does the same thing but with a more self-explanatory name extern "C" u_int8_t MP4GetTrackEsdsObjectTypeId( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEsdsObjectTypeId(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_AUDIO_TYPE; } extern "C" MP4Duration MP4GetTrackFixedSampleDuration( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackFixedSampleDuration(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" u_int32_t MP4GetTrackBitRate( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { MP4File *pFile = (MP4File *)hFile; try { return pFile->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate"); } catch (MP4Error* e) { //PRINT_ERROR(e); we don't really need to print this. delete e; } // if we're here, we can't get the bitrate from above - // lets calculate it try { MP4Duration trackDur; trackDur = MP4GetTrackDuration(hFile, trackId); uint64_t msDuration = pFile->ConvertFromTrackDuration(trackId, trackDur, MP4_MSECS_TIME_SCALE); if (msDuration == 0) return 0; MP4Track *pTrack = pFile->GetTrack(trackId); uint64_t bytes = pTrack->GetTotalOfSampleSizes(); bytes *= TO_U64(8 * 1000); bytes /= msDuration; return (uint32_t)bytes; } catch (MP4Error* e) { PRINT_ERROR(e); // print this one. delete e; } } return 0; } extern "C" bool MP4GetTrackESConfiguration( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetTrackESConfiguration( trackId, ppConfig, pConfigSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *ppConfig = NULL; *pConfigSize = 0; return false; } extern "C" bool MP4GetTrackVideoMetadata( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetTrackVideoMetadata( trackId, ppConfig, pConfigSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *ppConfig = NULL; *pConfigSize = 0; return false; } extern "C" bool MP4SetTrackESConfiguration( MP4FileHandle hFile, MP4TrackId trackId, const u_int8_t* pConfig, u_int32_t configSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackESConfiguration( trackId, pConfig, configSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetTrackH264ProfileLevel (MP4FileHandle hFile, MP4TrackId trackId, uint8_t *pProfile, uint8_t *pLevel) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *pProfile = ((MP4File *)hFile)->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*[0].avcC.AVCProfileIndication"); *pLevel = ((MP4File *)hFile)->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*[0].avcC.AVCLevelIndication"); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" void MP4GetTrackH264SeqPictHeaders (MP4FileHandle hFile, MP4TrackId trackId, uint8_t ***pSeqHeader, uint32_t **pSeqHeaderSize, uint8_t ***pPictHeader, uint32_t **pPictHeaderSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetTrackH264SeqPictHeaders(trackId, pSeqHeader, pSeqHeaderSize, pPictHeader, pPictHeaderSize); return; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return; } extern "C" bool MP4GetTrackH264LengthSize (MP4FileHandle hFile, MP4TrackId trackId, uint32_t *pLength) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *pLength = 1 + ((MP4File*) hFile)->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*[0].avcC.lengthSizeMinusOne"); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" MP4SampleId MP4GetTrackNumberOfSamples( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackNumberOfSamples(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" u_int16_t MP4GetTrackVideoWidth( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.width"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" u_int16_t MP4GetTrackVideoHeight( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.height"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" double MP4GetTrackVideoFrameRate( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackVideoFrameRate(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0.0; } extern "C" int MP4GetTrackAudioChannels (MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackAudioChannels(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return -1; } // returns true if the track is a media track encrypted according to ismacryp extern "C" bool MP4IsIsmaCrypMediaTrack( MP4FileHandle hFile, MP4TrackId trackId) { bool retval = false; uint32_t verb = MP4GetVerbosity(hFile); MP4SetVerbosity(hFile, verb & ~(MP4_DETAILS_ERROR)); if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { retval = ((MP4File*)hFile)->IsIsmaCrypMediaTrack(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } MP4SetVerbosity(hFile, verb); return retval; } /* generic track properties */ extern "C" bool MP4HaveTrackAtom (MP4FileHandle hFile, MP4TrackId trackId, const char *atomName) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->FindTrackAtom(trackId, atomName) != NULL; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetTrackIntegerProperty ( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, u_int64_t *retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetTrackFloatProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, float *retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetTrackFloatProperty(trackId, propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetTrackStringProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const char **retvalue) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { *retvalue = ((MP4File*)hFile)->GetTrackStringProperty(trackId, propName); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetTrackBytesProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, u_int8_t** ppValue, u_int32_t* pValueSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetTrackBytesProperty( trackId, propName, ppValue, pValueSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *ppValue = NULL; *pValueSize = 0; return false; } extern "C" bool MP4SetTrackIntegerProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, int64_t value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackIntegerProperty(trackId, propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetTrackFloatProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, float value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackFloatProperty(trackId, propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetTrackStringProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackStringProperty(trackId, propName, value); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetTrackBytesProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const u_int8_t* pValue, u_int32_t valueSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackBytesProperty( trackId, propName, pValue, valueSize); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } /* sample operations */ extern "C" bool MP4ReadSample( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, /* output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->ReadSample( trackId, sampleId, ppBytes, pNumBytes, pStartTime, pDuration, pRenderingOffset, pIsSyncSample); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *pNumBytes = 0; return false; } extern "C" bool MP4ReadSampleFromTime( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, /* output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4SampleId sampleId = ((MP4File*)hFile)->GetSampleIdFromTime( trackId, when, false); ((MP4File*)hFile)->ReadSample( trackId, sampleId, ppBytes, pNumBytes, pStartTime, pDuration, pRenderingOffset, pIsSyncSample); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } *pNumBytes = 0; return false; } extern "C" bool MP4WriteSample( MP4FileHandle hFile, MP4TrackId trackId, const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->WriteSample( trackId, pBytes, numBytes, duration, renderingOffset, isSyncSample); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4CopySample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile, MP4TrackId dstTrackId, MP4Duration dstSampleDuration) { bool rc; u_int8_t* pBytes = NULL; u_int32_t numBytes = 0; MP4Duration sampleDuration; MP4Duration renderingOffset; bool isSyncSample; // Note: we leave it up to the caller to ensure that the // source and destination tracks are compatible. // i.e. copying audio samples into a video track // is unlikely to do anything useful rc = MP4ReadSample( srcFile, srcTrackId, srcSampleId, &pBytes, &numBytes, NULL, &sampleDuration, &renderingOffset, &isSyncSample); if (!rc) { return false; } if (dstFile == MP4_INVALID_FILE_HANDLE) { dstFile = srcFile; } if (dstTrackId == MP4_INVALID_TRACK_ID) { dstTrackId = srcTrackId; } if (dstSampleDuration != MP4_INVALID_DURATION) { sampleDuration = dstSampleDuration; } rc = MP4WriteSample( dstFile, dstTrackId, pBytes, numBytes, sampleDuration, renderingOffset, isSyncSample); free(pBytes); return rc; } extern "C" bool MP4EncAndCopySample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, encryptFunc_t encfcnp, u_int32_t encfcnparam1, MP4FileHandle dstFile, MP4TrackId dstTrackId, MP4Duration dstSampleDuration) { bool rc; u_int8_t* pBytes = NULL; u_int32_t numBytes = 0; u_int8_t* encSampleData = NULL; u_int32_t encSampleLength = 0; MP4Duration sampleDuration; MP4Duration renderingOffset; bool isSyncSample; // Note: we leave it up to the caller to ensure that the // source and destination tracks are compatible. // i.e. copying audio samples into a video track // is unlikely to do anything useful rc = MP4ReadSample( srcFile, srcTrackId, srcSampleId, &pBytes, &numBytes, NULL, &sampleDuration, &renderingOffset, &isSyncSample); if (!rc) { return false; } if (dstFile == MP4_INVALID_FILE_HANDLE) { dstFile = srcFile; } if (dstTrackId == MP4_INVALID_TRACK_ID) { dstTrackId = srcTrackId; } if (dstSampleDuration != MP4_INVALID_DURATION) { sampleDuration = dstSampleDuration; } //if (ismacrypEncryptSampleAddHeader(ismaCryptSId, numBytes, pBytes, // &encSampleLength, &encSampleData) != 0) { if (encfcnp(encfcnparam1, numBytes, pBytes, &encSampleLength, &encSampleData) != 0) { fprintf(stderr, "Can't encrypt the sample and add its header %u\n", srcSampleId); } rc = MP4WriteSample( dstFile, dstTrackId, encSampleData, encSampleLength, sampleDuration, renderingOffset, isSyncSample); free(pBytes); if (encSampleData != NULL) { free(encSampleData); } return rc; } extern "C" bool MP4ReferenceSample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile, MP4TrackId dstTrackId, MP4Duration dstSampleDuration) { // LATER Not yet implemented return false; } extern "C" u_int32_t MP4GetSampleSize( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleSize( trackId, sampleId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" u_int32_t MP4GetTrackMaxSampleSize( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackMaxSampleSize(trackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" MP4SampleId MP4GetSampleIdFromTime( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, bool wantSyncSample) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleIdFromTime( trackId, when, wantSyncSample); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_SAMPLE_ID; } extern "C" MP4Timestamp MP4GetSampleTime( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleTime( trackId, sampleId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TIMESTAMP; } extern "C" MP4Duration MP4GetSampleDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleDuration( trackId, sampleId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" MP4Duration MP4GetSampleRenderingOffset( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleRenderingOffset( trackId, sampleId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" bool MP4SetSampleRenderingOffset( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, MP4Duration renderingOffset) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetSampleRenderingOffset( trackId, sampleId, renderingOffset); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" int8_t MP4GetSampleSync( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleSync( trackId, sampleId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return -1; } extern "C" u_int64_t MP4ConvertFromMovieDuration( MP4FileHandle hFile, MP4Duration duration, u_int32_t timeScale) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->ConvertFromMovieDuration( duration, timeScale); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return (u_int64_t)MP4_INVALID_DURATION; } extern "C" u_int64_t MP4ConvertFromTrackTimestamp( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp timeStamp, u_int32_t timeScale) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->ConvertFromTrackTimestamp( trackId, timeStamp, timeScale); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return (u_int64_t)MP4_INVALID_TIMESTAMP; } extern "C" MP4Timestamp MP4ConvertToTrackTimestamp( MP4FileHandle hFile, MP4TrackId trackId, u_int64_t timeStamp, u_int32_t timeScale) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->ConvertToTrackTimestamp( trackId, timeStamp, timeScale); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TIMESTAMP; } extern "C" u_int64_t MP4ConvertFromTrackDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4Duration duration, u_int32_t timeScale) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->ConvertFromTrackDuration( trackId, duration, timeScale); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return (u_int64_t)MP4_INVALID_DURATION; } extern "C" MP4Duration MP4ConvertToTrackDuration( MP4FileHandle hFile, MP4TrackId trackId, u_int64_t duration, u_int32_t timeScale) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->ConvertToTrackDuration( trackId, duration, timeScale); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" bool MP4GetHintTrackRtpPayload( MP4FileHandle hFile, MP4TrackId hintTrackId, char** ppPayloadName, u_int8_t* pPayloadNumber, u_int16_t* pMaxPayloadSize, char **ppEncodingParams) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->GetHintTrackRtpPayload( hintTrackId, ppPayloadName, pPayloadNumber, pMaxPayloadSize, ppEncodingParams); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetHintTrackRtpPayload( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* pPayloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize, const char *encode_params, bool include_rtp_map, bool include_mpeg4_esid) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetHintTrackRtpPayload( hintTrackId, pPayloadName, pPayloadNumber, maxPayloadSize, encode_params, include_rtp_map, include_mpeg4_esid); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" const char* MP4GetSessionSdp( MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSessionSdp(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return NULL; } extern "C" bool MP4SetSessionSdp( MP4FileHandle hFile, const char* sdpString) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetSessionSdp(sdpString); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AppendSessionSdp( MP4FileHandle hFile, const char* sdpString) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AppendSessionSdp(sdpString); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" const char* MP4GetHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetHintTrackSdp(hintTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return NULL; } extern "C" bool MP4SetHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* sdpString) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetHintTrackSdp(hintTrackId, sdpString); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AppendHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* sdpString) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AppendHintTrackSdp(hintTrackId, sdpString); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" MP4TrackId MP4GetHintTrackReferenceTrackId( MP4FileHandle hFile, MP4TrackId hintTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> GetHintTrackReferenceTrackId(hintTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TRACK_ID; } extern "C" bool MP4ReadRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4SampleId hintSampleId, u_int16_t* pNumPackets) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->ReadRtpHint( hintTrackId, hintSampleId, pNumPackets); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int16_t MP4GetRtpHintNumberOfPackets( MP4FileHandle hFile, MP4TrackId hintTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetRtpHintNumberOfPackets(hintTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" int8_t MP4GetRtpPacketBFrame( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> GetRtpPacketBFrame(hintTrackId, packetIndex); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return -1; } extern "C" int32_t MP4GetRtpPacketTransmitOffset( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)-> GetRtpPacketTransmitOffset(hintTrackId, packetIndex); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0; } extern "C" bool MP4ReadRtpPacket( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc, bool includeHeader, bool includePayload) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->ReadRtpPacket( hintTrackId, packetIndex, ppBytes, pNumBytes, ssrc, includeHeader, includePayload); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" MP4Timestamp MP4GetRtpTimestampStart( MP4FileHandle hFile, MP4TrackId hintTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetRtpTimestampStart(hintTrackId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TIMESTAMP; } extern "C" bool MP4SetRtpTimestampStart( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4Timestamp rtpStart) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetRtpTimestampStart( hintTrackId, rtpStart); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AddRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId) { return MP4AddRtpVideoHint(hFile, hintTrackId, false, 0); } extern "C" bool MP4AddRtpVideoHint( MP4FileHandle hFile, MP4TrackId hintTrackId, bool isBframe, u_int32_t timestampOffset) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AddRtpHint(hintTrackId, isBframe, timestampOffset); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AddRtpPacket( MP4FileHandle hFile, MP4TrackId hintTrackId, bool setMbit, int32_t transmitOffset) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AddRtpPacket( hintTrackId, setMbit, transmitOffset); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AddRtpImmediateData( MP4FileHandle hFile, MP4TrackId hintTrackId, const u_int8_t* pBytes, u_int32_t numBytes) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AddRtpImmediateData(hintTrackId, pBytes, numBytes); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AddRtpSampleData( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AddRtpSampleData( hintTrackId, sampleId, dataOffset, dataLength); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4AddRtpESConfigurationPacket( MP4FileHandle hFile, MP4TrackId hintTrackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->AddRtpESConfigurationPacket(hintTrackId); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4WriteRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4Duration duration, bool isSyncSample) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->WriteRtpHint( hintTrackId, duration, isSyncSample); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } /* 3GPP specific operations */ extern "C" bool MP4Make3GPCompliant( const char* fileName, u_int32_t verbosity, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount, bool deleteIodsAtom) { MP4File* pFile; pFile = NULL; try { pFile = new MP4File(verbosity); pFile->Modify(fileName); pFile->Make3GPCompliant(fileName, majorBrand, minorVersion, supportedBrands, supportedBrandsCount, deleteIodsAtom); pFile->Close(); delete pFile; return true; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; } delete pFile; return false; } /* ISMA specific operations */ extern "C" bool MP4MakeIsmaCompliant( const char* fileName, u_int32_t verbosity, bool addIsmaComplianceSdp) { MP4File* pFile; pFile = NULL; try { pFile = new MP4File(verbosity); pFile->Modify(fileName); pFile->MakeIsmaCompliant(addIsmaComplianceSdp); pFile->Close(); delete pFile; return true; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; } delete pFile; return false; } extern "C" char* MP4MakeIsmaSdpIod( u_int8_t videoProfile, u_int32_t videoBitrate, u_int8_t* videoConfig, u_int32_t videoConfigLength, u_int8_t audioProfile, u_int32_t audioBitrate, u_int8_t* audioConfig, u_int32_t audioConfigLength, u_int32_t verbosity) { MP4File* pFile = NULL; try { pFile = new MP4File(verbosity); u_int8_t* pBytes = NULL; u_int64_t numBytes = 0; pFile->CreateIsmaIodFromParams( videoProfile, videoBitrate, videoConfig, videoConfigLength, audioProfile, audioBitrate, audioConfig, audioConfigLength, &pBytes, &numBytes); char* iodBase64 = MP4ToBase64(pBytes, numBytes); MP4Free(pBytes); char* sdpIod = (char*)MP4Malloc(strlen(iodBase64) + 64); snprintf(sdpIod, strlen(iodBase64) + 64, "a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042", iodBase64); MP4Free(iodBase64); delete pFile; return sdpIod; } catch (MP4Error* e) { VERBOSE_ERROR(verbosity, e->Print()); delete e; } return NULL; } /* Edit list */ extern "C" MP4EditId MP4AddTrackEdit( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime, MP4Duration duration, bool dwell) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { MP4EditId newEditId = ((MP4File*)hFile)->AddTrackEdit(trackId, editId); if (newEditId != MP4_INVALID_EDIT_ID) { ((MP4File*)hFile)->SetTrackEditMediaStart( trackId, newEditId, startTime); ((MP4File*)hFile)->SetTrackEditDuration( trackId, newEditId, duration); ((MP4File*)hFile)->SetTrackEditDwell( trackId, newEditId, dwell); } return newEditId; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_EDIT_ID; } extern "C" bool MP4DeleteTrackEdit( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->DeleteTrackEdit(trackId, editId); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int32_t MP4GetTrackNumberOfEdits( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackNumberOfEdits(trackId); } catch (MP4Error* e) { //PRINT_ERROR(e); delete e; } } return 0; } extern "C" MP4Timestamp MP4GetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditMediaStart( trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TIMESTAMP; } extern "C" MP4Duration MP4GetTrackEditTotalDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditTotalDuration( trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" bool MP4SetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditMediaStart( trackId, editId, startTime); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" MP4Duration MP4GetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditDuration(trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION; } extern "C" bool MP4SetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Duration duration) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditDuration(trackId, editId, duration); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" int8_t MP4GetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditDwell(trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return -1; } extern "C" bool MP4SetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, bool dwell) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditDwell(trackId, editId, dwell); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4ReadSampleFromEditTime( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, /* output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample) { MP4SampleId sampleId = MP4GetSampleIdFromEditTime( hFile, trackId, when, pStartTime, pDuration); return MP4ReadSample( hFile, trackId, sampleId, ppBytes, pNumBytes, NULL, NULL, pRenderingOffset, pIsSyncSample); } extern "C" MP4SampleId MP4GetSampleIdFromEditTime( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, MP4Timestamp* pStartTime, MP4Duration* pDuration) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleIdFromEditTime( trackId, when, pStartTime, pDuration); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_SAMPLE_ID; } /* Utlities */ extern "C" char* MP4BinaryToBase16( const u_int8_t* pData, u_int32_t dataSize) { if (pData || dataSize == 0) { try { return MP4ToBase16(pData, dataSize); } catch (MP4Error* e) { delete e; } } return NULL; } extern "C" char* MP4BinaryToBase64( const u_int8_t* pData, u_int32_t dataSize) { if (pData || dataSize == 0) { try { return MP4ToBase64(pData, dataSize); } catch (MP4Error* e) { delete e; } } return NULL; } /* iTunes meta data handling */ extern "C" bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, char** ppName, u_int8_t** ppValue, u_int32_t* pValueSize) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataByIndex( index, ppName, ppValue, pValueSize); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4MetadataDelete(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->MetadataDelete(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataName(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251nam", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataName(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251nam", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataName(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251nam"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251wrt", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251wrt", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataWriter(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251wrt"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251alb", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251alb", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataAlbum(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251alb"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251ART", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251ART", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataArtist(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251ART"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251too", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataTool(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251too", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataTool(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251too"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251cmt", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataComment(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251cmt", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataComment(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251cmt"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251day", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataYear(MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251day", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataYear(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251day"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataTrack(MP4FileHandle hFile, u_int16_t track, u_int16_t totalTracks) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataTrack(track, totalTracks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataTrack(MP4FileHandle hFile, u_int16_t* track, u_int16_t* totalTracks) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataTrack(track, totalTracks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataTrack(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("trkn"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataDisk(MP4FileHandle hFile, u_int16_t disk, u_int16_t totalDisks) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataDisk(disk, totalDisks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataDisk(MP4FileHandle hFile, u_int16_t* disk, u_int16_t* totalDisks) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataDisk(disk, totalDisks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataDisk(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("disk"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataGenre(genre); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataGenre(genre); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataGenre(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataGenre(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("\251grp", grouping); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("\251grp", grouping); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataGrouping(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("\251grp"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataTempo(tempo); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataTempo(tempo); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataTempo(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("tmpo"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataUint8("cpil", cpl & 0x1); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataUint8("cpil", cpl); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataCompilation(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("cpil"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataPartOfGaplessAlbum (MP4FileHandle hFile, u_int8_t pgap) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataUint8("pgap", pgap & 0x1); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataPartOfGaplessAlbum (MP4FileHandle hFile, u_int8_t* pgap) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataUint8("pgap", pgap); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataPartOfGaplessAlbum (MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("pgap"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataCoverArt(MP4FileHandle hFile, u_int8_t *coverArt, u_int32_t size) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataCoverArt(coverArt, size); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataCoverArt(MP4FileHandle hFile, u_int8_t **coverArt, u_int32_t* size, uint32_t index) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataCoverArt(coverArt, size, index); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" u_int32_t MP4GetMetadataCoverArtCount(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataCoverArtCount(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("covr"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataAlbumArtist (MP4FileHandle hFile, const char* value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataString("aART", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataAlbumArtist (MP4FileHandle hFile, char** value) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataString("aART", value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataAlbumArtist (MP4FileHandle hFile) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataAtom("aART"); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4SetMetadataFreeForm(MP4FileHandle hFile, const char *name, const u_int8_t* pValue, u_int32_t valueSize, const char *owner) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataFreeForm(name, pValue, valueSize, owner); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4GetMetadataFreeForm(MP4FileHandle hFile, const char *name, u_int8_t** pValue, u_int32_t* valueSize, const char *owner) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataFreeForm(name, pValue, valueSize, owner); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, const char *name, const char *owner) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->DeleteMetadataFreeForm(name, owner); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false; } extern "C" void MP4Free (void *p) { if (p != NULL) free(p); } faac-1.28/common/mp4v2/mp4.h0000644010307701030770000011074611136736372017177 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com * Bill May wmay@cisco.com */ #ifndef __MP4_INCLUDED__ #define __MP4_INCLUDED__ /* include system and project specific headers */ #include "mpeg4ip.h" #include /* to define float HUGE_VAL and/or NAN */ #ifndef NAN #define NAN HUGE_VAL #endif #ifndef DEFAULT #ifdef __cplusplus /* exploit C++ ability of default values for function parameters */ #define DEFAULT(x) =x #else #define DEFAULT(x) #endif #endif /* MP4 API types */ typedef void* MP4FileHandle; typedef u_int32_t MP4TrackId; typedef u_int32_t MP4SampleId; typedef u_int64_t MP4Timestamp; typedef u_int64_t MP4Duration; typedef u_int32_t MP4EditId; typedef u_int64_t (*VIRTUALIO_GETFILELENGTH)(void *user); // return file length in bytes typedef int (*VIRTUALIO_SETPOSITION)(void *user, u_int64_t position); // return 0 on success typedef int (*VIRTUALIO_GETPOSITION)(void *user, u_int64_t *position); // fill position, return 0 on success typedef size_t (*VIRTUALIO_READ)(void *user, void *buffer, size_t size); // return number of bytes actually read typedef size_t (*VIRTUALIO_WRITE)(void *user, void *buffer, size_t size); // return number of bytes actually written typedef int (*VIRTUALIO_ENDOFFILE)(void *user); // return 1 if file hit EOF typedef int (*VIRTUALIO_CLOSE)(void *user); // return 0 on success typedef struct Virtual_IO { VIRTUALIO_GETFILELENGTH GetFileLength; VIRTUALIO_SETPOSITION SetPosition; VIRTUALIO_GETPOSITION GetPosition; VIRTUALIO_READ Read; VIRTUALIO_WRITE Write; VIRTUALIO_ENDOFFILE EndOfFile; VIRTUALIO_CLOSE Close; } Virtual_IO_t; /* Invalid values for API types */ #define MP4_INVALID_FILE_HANDLE ((MP4FileHandle)NULL) #define MP4_INVALID_TRACK_ID ((MP4TrackId)0) #define MP4_INVALID_SAMPLE_ID ((MP4SampleId)0) #define MP4_INVALID_TIMESTAMP ((MP4Timestamp)-1) #define MP4_INVALID_DURATION ((MP4Duration)-1) #define MP4_INVALID_EDIT_ID ((MP4EditId)0) /* Macros to test for API type validity */ #define MP4_IS_VALID_FILE_HANDLE(x) ((x) != MP4_INVALID_FILE_HANDLE) #define MP4_IS_VALID_TRACK_ID(x) ((x) != MP4_INVALID_TRACK_ID) #define MP4_IS_VALID_SAMPLE_ID(x) ((x) != MP4_INVALID_SAMPLE_ID) #define MP4_IS_VALID_TIMESTAMP(x) ((x) != MP4_INVALID_TIMESTAMP) #define MP4_IS_VALID_DURATION(x) ((x) != MP4_INVALID_DURATION) #define MP4_IS_VALID_EDIT_ID(x) ((x) != MP4_INVALID_EDIT_ID) /* MP4 verbosity levels - e.g. MP4SetVerbosity() */ #define MP4_DETAILS_ALL 0xFFFFFFFF #define MP4_DETAILS_ERROR 0x00000001 #define MP4_DETAILS_WARNING 0x00000002 #define MP4_DETAILS_READ 0x00000004 #define MP4_DETAILS_WRITE 0x00000008 #define MP4_DETAILS_FIND 0x00000010 #define MP4_DETAILS_TABLE 0x00000020 #define MP4_DETAILS_SAMPLE 0x00000040 #define MP4_DETAILS_HINT 0x00000080 #define MP4_DETAILS_ISMA 0x00000100 #define MP4_DETAILS_EDIT 0x00000200 #define MP4_DETAILS_READ_ALL \ (MP4_DETAILS_READ | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) #define MP4_DETAILS_WRITE_ALL \ (MP4_DETAILS_WRITE | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) /* * MP4 Known track type names - e.g. MP4GetNumberOfTracks(type) * * Note this first group of track types should be created * via the MP4AddTrack() functions, and not MP4AddTrack(type) */ #define MP4_OD_TRACK_TYPE "odsm" #define MP4_SCENE_TRACK_TYPE "sdsm" #define MP4_AUDIO_TRACK_TYPE "soun" #define MP4_VIDEO_TRACK_TYPE "vide" #define MP4_HINT_TRACK_TYPE "hint" #define MP4_CNTL_TRACK_TYPE "cntl" #define MP4_TEXT_TRACK_TYPE "text" /* * This second set of track types should be created * via MP4AddSystemsTrack(type) */ #define MP4_CLOCK_TRACK_TYPE "crsm" #define MP4_MPEG7_TRACK_TYPE "m7sm" #define MP4_OCI_TRACK_TYPE "ocsm" #define MP4_IPMP_TRACK_TYPE "ipsm" #define MP4_MPEGJ_TRACK_TYPE "mjsm" #define MP4_IS_VIDEO_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_VIDEO_TRACK_TYPE)) #define MP4_IS_AUDIO_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_AUDIO_TRACK_TYPE)) #define MP4_IS_CNTL_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_CNTL_TRACK_TYPE)) #define MP4_IS_OD_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_OD_TRACK_TYPE)) #define MP4_IS_SCENE_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_SCENE_TRACK_TYPE)) #define MP4_IS_HINT_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_HINT_TRACK_TYPE)) #define MP4_IS_SYSTEMS_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_CLOCK_TRACK_TYPE) \ || !strcasecmp(type, MP4_MPEG7_TRACK_TYPE) \ || !strcasecmp(type, MP4_OCI_TRACK_TYPE) \ || !strcasecmp(type, MP4_IPMP_TRACK_TYPE) \ || !strcasecmp(type, MP4_MPEGJ_TRACK_TYPE)) /* MP4 Audio track types - see MP4AddAudioTrack()*/ #define MP4_INVALID_AUDIO_TYPE 0x00 #define MP4_MPEG1_AUDIO_TYPE 0x6B #define MP4_MPEG2_AUDIO_TYPE 0x69 #define MP4_MP3_AUDIO_TYPE MP4_MPEG2_AUDIO_TYPE #define MP4_MPEG2_AAC_MAIN_AUDIO_TYPE 0x66 #define MP4_MPEG2_AAC_LC_AUDIO_TYPE 0x67 #define MP4_MPEG2_AAC_SSR_AUDIO_TYPE 0x68 #define MP4_MPEG2_AAC_AUDIO_TYPE MP4_MPEG2_AAC_MAIN_AUDIO_TYPE #define MP4_MPEG4_AUDIO_TYPE 0x40 #define MP4_PRIVATE_AUDIO_TYPE 0xC0 #define MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE 0xE0 /* a private definition */ #define MP4_VORBIS_AUDIO_TYPE 0xE1 /* a private definition */ #define MP4_AC3_AUDIO_TYPE 0xE2 /* a private definition */ #define MP4_ALAW_AUDIO_TYPE 0xE3 /* a private definition */ #define MP4_ULAW_AUDIO_TYPE 0xE4 /* a private definition */ #define MP4_G723_AUDIO_TYPE 0xE5 /* a private definition */ #define MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE 0xE6 /* a private definition */ /* MP4 MPEG-4 Audio types from 14496-3 Table 1.5.1 */ #define MP4_MPEG4_INVALID_AUDIO_TYPE 0 #define MP4_MPEG4_AAC_MAIN_AUDIO_TYPE 1 #define MP4_MPEG4_AAC_LC_AUDIO_TYPE 2 #define MP4_MPEG4_AAC_SSR_AUDIO_TYPE 3 #define MP4_MPEG4_AAC_LTP_AUDIO_TYPE 4 #define MP4_MPEG4_AAC_HE_AUDIO_TYPE 5 #define MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE 6 #define MP4_MPEG4_CELP_AUDIO_TYPE 8 #define MP4_MPEG4_HVXC_AUDIO_TYPE 9 #define MP4_MPEG4_TTSI_AUDIO_TYPE 12 #define MP4_MPEG4_MAIN_SYNTHETIC_AUDIO_TYPE 13 #define MP4_MPEG4_WAVETABLE_AUDIO_TYPE 14 #define MP4_MPEG4_MIDI_AUDIO_TYPE 15 #define MP4_MPEG4_ALGORITHMIC_FX_AUDIO_TYPE 16 #define MP4_MPEG4_ALS_AUDIO_TYPE 31 #define MP4_MPEG4_LAYER1_AUDIO_TYPE 32 #define MP4_MPEG4_LAYER2_AUDIO_TYPE 33 #define MP4_MPEG4_LAYER3_AUDIO_TYPE 34 #define MP4_MPEG4_SLS_AUDIO_TYPE 35 /* MP4 Audio type utilities following common usage */ #define MP4_IS_MP3_AUDIO_TYPE(type) \ ((type) == MP4_MPEG1_AUDIO_TYPE || (type) == MP4_MPEG2_AUDIO_TYPE) #define MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ (((type) >= MP4_MPEG2_AAC_MAIN_AUDIO_TYPE \ && (type) <= MP4_MPEG2_AAC_SSR_AUDIO_TYPE)) #define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \ (((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \ && (mpeg4Type) <= MP4_MPEG4_AAC_HE_AUDIO_TYPE) \ || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \ || (mpeg4Type) == 17) #define MP4_IS_AAC_AUDIO_TYPE(type) \ (MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ || (type) == MP4_MPEG4_AUDIO_TYPE) /* MP4 Video track types - see MP4AddVideoTrack() */ #define MP4_INVALID_VIDEO_TYPE 0x00 #define MP4_MPEG1_VIDEO_TYPE 0x6A #define MP4_MPEG2_SIMPLE_VIDEO_TYPE 0x60 #define MP4_MPEG2_MAIN_VIDEO_TYPE 0x61 #define MP4_MPEG2_SNR_VIDEO_TYPE 0x62 #define MP4_MPEG2_SPATIAL_VIDEO_TYPE 0x63 #define MP4_MPEG2_HIGH_VIDEO_TYPE 0x64 #define MP4_MPEG2_442_VIDEO_TYPE 0x65 #define MP4_MPEG2_VIDEO_TYPE MP4_MPEG2_MAIN_VIDEO_TYPE #define MP4_MPEG4_VIDEO_TYPE 0x20 #define MP4_JPEG_VIDEO_TYPE 0x6C #define MP4_PRIVATE_VIDEO_TYPE 0xD0 #define MP4_YUV12_VIDEO_TYPE 0xF0 /* a private definition */ #define MP4_H263_VIDEO_TYPE 0xF2 /* a private definition */ #define MP4_H261_VIDEO_TYPE 0xF3 /* a private definition */ /* MP4 Video type utilities */ #define MP4_IS_MPEG1_VIDEO_TYPE(type) \ ((type) == MP4_MPEG1_VIDEO_TYPE) #define MP4_IS_MPEG2_VIDEO_TYPE(type) \ (((type) >= MP4_MPEG2_SIMPLE_VIDEO_TYPE \ && (type) <= MP4_MPEG2_442_VIDEO_TYPE) \ || MP4_IS_MPEG1_VIDEO_TYPE(type)) #define MP4_IS_MPEG4_VIDEO_TYPE(type) \ ((type) == MP4_MPEG4_VIDEO_TYPE) /* Mpeg4 Visual Profile Defines - ISO/IEC 14496-2:2001/Amd.2:2002(E) */ #define MPEG4_SP_L1 (0x1) #define MPEG4_SP_L2 (0x2) #define MPEG4_SP_L3 (0x3) #define MPEG4_SP_L0 (0x8) #define MPEG4_SSP_L1 (0x11) #define MPEG4_SSP_L2 (0x12) #define MPEG4_CP_L1 (0x21) #define MPEG4_CP_L2 (0x22) #define MPEG4_MP_L2 (0x32) #define MPEG4_MP_L3 (0x33) #define MPEG4_MP_L4 (0x34) #define MPEG4_NBP_L2 (0x42) #define MPEG4_STP_L1 (0x51) #define MPEG4_SFAP_L1 (0x61) #define MPEG4_SFAP_L2 (0x62) #define MPEG4_SFBAP_L1 (0x63) #define MPEG4_SFBAP_L2 (0x64) #define MPEG4_BATP_L1 (0x71) #define MPEG4_BATP_L2 (0x72) #define MPEG4_HP_L1 (0x81) #define MPEG4_HP_L2 (0x82) #define MPEG4_ARTSP_L1 (0x91) #define MPEG4_ARTSP_L2 (0x92) #define MPEG4_ARTSP_L3 (0x93) #define MPEG4_ARTSP_L4 (0x94) #define MPEG4_CSP_L1 (0xa1) #define MPEG4_CSP_L2 (0xa2) #define MPEG4_CSP_L3 (0xa3) #define MPEG4_ACEP_L1 (0xb1) #define MPEG4_ACEP_L2 (0xb2) #define MPEG4_ACEP_L3 (0xb3) #define MPEG4_ACEP_L4 (0xb4) #define MPEG4_ACP_L1 (0xc1) #define MPEG4_ACP_L2 (0xc2) #define MPEG4_AST_L1 (0xd1) #define MPEG4_AST_L2 (0xd2) #define MPEG4_AST_L3 (0xd3) #define MPEG4_S_STUDIO_P_L1 (0xe1) #define MPEG4_S_STUDIO_P_L2 (0xe2) #define MPEG4_S_STUDIO_P_L3 (0xe3) #define MPEG4_S_STUDIO_P_L4 (0xe4) #define MPEG4_C_STUDIO_P_L1 (0xe5) #define MPEG4_C_STUDIO_P_L2 (0xe6) #define MPEG4_C_STUDIO_P_L3 (0xe7) #define MPEG4_C_STUDIO_P_L4 (0xe8) #define MPEG4_ASP_L0 (0xF0) #define MPEG4_ASP_L1 (0xF1) #define MPEG4_ASP_L2 (0xF2) #define MPEG4_ASP_L3 (0xF3) #define MPEG4_ASP_L4 (0xF4) #define MPEG4_ASP_L5 (0xF5) #define MPEG4_ASP_L3B (0xF7) #define MPEG4_FGSP_L0 (0xf8) #define MPEG4_FGSP_L1 (0xf9) #define MPEG4_FGSP_L2 (0xfa) #define MPEG4_FGSP_L3 (0xfb) #define MPEG4_FGSP_L4 (0xfc) #define MPEG4_FGSP_L5 (0xfd) /* MP4 API declarations */ #ifdef __cplusplus extern "C" { #endif /* file operations */ #define MP4_CREATE_64BIT_DATA (0x01) #define MP4_CREATE_64BIT_TIME (0x02) // Quicktime is not compatible with this #define MP4_CREATE_64BIT (MP4_CREATE_64BIT_DATA | MP4_CREATE_64BIT_TIME) #define MP4_CREATE_EXTENSIBLE_FORMAT (0x04) MP4FileHandle MP4Create( const char* fileName, u_int32_t verbosity DEFAULT(0), u_int32_t flags DEFAULT(0)); MP4FileHandle MP4CreateEx( const char *fileName, u_int32_t verbosity DEFAULT(0), u_int32_t flags DEFAULT(0), int add_ftyp DEFAULT(1), int add_iods DEFAULT(1), char* majorBrand DEFAULT(0), u_int32_t minorVersion DEFAULT(0), char** supportedBrands DEFAULT(0), u_int32_t supportedBrandsCount DEFAULT(0)); MP4FileHandle MP4Modify( const char* fileName, u_int32_t verbosity DEFAULT(0), u_int32_t flags DEFAULT(0)); MP4FileHandle MP4Read( const char* fileName, u_int32_t verbosity DEFAULT(0)); // benski> MP4FileHandle MP4ReadEx(const char* fileName, void *user, Virtual_IO_t *virtual_IO, u_int32_t verbosity DEFAULT(0)); void MP4Close( MP4FileHandle hFile); bool MP4Optimize( const char* existingFileName, const char* newFileName DEFAULT(NULL), u_int32_t verbosity DEFAULT(0)); bool MP4Dump( MP4FileHandle hFile, FILE* pDumpFile DEFAULT(NULL), bool dumpImplicits DEFAULT(0)); char* MP4Info( MP4FileHandle hFile, MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); char* MP4FileInfo( const char* fileName, MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); /* file properties */ /* specific file properties */ u_int32_t MP4GetVerbosity(MP4FileHandle hFile); void MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity); MP4Duration MP4GetDuration(MP4FileHandle hFile); u_int32_t MP4GetTimeScale(MP4FileHandle hFile); bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value); u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile); bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value); u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile); bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value); u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile, MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); void MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value); u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile); void MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value); u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile); bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value); /* generic file properties */ bool MP4HaveAtom(MP4FileHandle hFile, const char *atomName); bool MP4GetIntegerProperty( MP4FileHandle hFile, const char* propName, u_int64_t *retval ); bool MP4GetFloatProperty( MP4FileHandle hFile, const char* propName, float *retvalue); bool MP4GetStringProperty( MP4FileHandle hFile, const char* propName, const char **retvalue); bool MP4GetBytesProperty( MP4FileHandle hFile, const char* propName, u_int8_t** ppValue, u_int32_t* pValueSize); bool MP4SetIntegerProperty( MP4FileHandle hFile, const char* propName, int64_t value); bool MP4SetFloatProperty( MP4FileHandle hFile, const char* propName, float value); bool MP4SetStringProperty( MP4FileHandle hFile, const char* propName, const char* value); bool MP4SetBytesProperty( MP4FileHandle hFile, const char* propName, const u_int8_t* pValue, u_int32_t valueSize); /* track operations */ MP4TrackId MP4AddTrack( MP4FileHandle hFile, const char* type); MP4TrackId MP4AddSystemsTrack( MP4FileHandle hFile, const char* type); MP4TrackId MP4AddODTrack( MP4FileHandle hFile); MP4TrackId MP4AddSceneTrack( MP4FileHandle hFile); MP4TrackId MP4AddAudioTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); typedef struct mp4v2_ismacryp_session_params { u_int32_t scheme_type; u_int16_t scheme_version; u_int8_t key_ind_len; u_int8_t iv_len; u_int8_t selective_enc; const char *kms_uri; } mp4v2_ismacrypParams; // API to initialize ismacryp properties to sensible defaults // if input param is null then mallocs a params struct mp4v2_ismacrypParams *MP4DefaultISMACrypParams(mp4v2_ismacrypParams *ptr); MP4TrackId MP4AddEncAudioTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, mp4v2_ismacrypParams *icPp, u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); MP4TrackId MP4AddAmrAudioTrack( MP4FileHandle hFile, u_int32_t timeScale, u_int16_t modeSet, u_int8_t modeChangePeriod, u_int8_t framesPerSample, bool isAmrWB); void MP4SetAmrVendor( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t vendor); void MP4SetAmrDecoderVersion( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t decoderVersion); void MP4SetAmrModeSet(MP4FileHandle hFile, MP4TrackId trakId, uint16_t modeSet); uint16_t MP4GetAmrModeSet(MP4FileHandle hFile, MP4TrackId trackId); MP4TrackId MP4AddHrefTrack(MP4FileHandle hFile, uint32_t timeScale, MP4Duration sampleDuration, const char *base_url DEFAULT(NULL)); const char *MP4GetHrefTrackBaseUrl(MP4FileHandle hFile, MP4TrackId trackId); MP4TrackId MP4AddVideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE)); MP4TrackId MP4AddEncVideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, mp4v2_ismacrypParams *icPp, u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE), const char *oFormat DEFAULT(NULL)); MP4TrackId MP4AddH264VideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, uint8_t AVCProfileIndication, uint8_t profile_compat, uint8_t AVCLevelIndication, uint8_t sampleLenFieldSizeMinusOne); MP4TrackId MP4AddEncH264VideoTrack( MP4FileHandle dstFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp); void MP4AddH264SequenceParameterSet(MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pSequence, uint16_t sequenceLen); void MP4AddH264PictureParameterSet(MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pPict, uint16_t pictLen); void MP4SetH263Vendor( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t vendor); void MP4SetH263DecoderVersion( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t decoderVersion); void MP4SetH263Bitrates( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t avgBitrate, u_int32_t maxBitrate); MP4TrackId MP4AddH263VideoTrack( MP4FileHandle hFile, u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t h263Level, u_int8_t h263Profile, u_int32_t avgBitrate, u_int32_t maxBitrate); MP4TrackId MP4AddHintTrack( MP4FileHandle hFile, MP4TrackId refTrackId); MP4TrackId MP4AddTextTrack( MP4FileHandle hFile, MP4TrackId refTrackId); MP4TrackId MP4AddChapterTextTrack( MP4FileHandle hFile, MP4TrackId refTrackId); MP4TrackId MP4CloneTrack( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); MP4TrackId MP4EncAndCloneTrack( MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); MP4TrackId MP4CopyTrack( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), bool applyEdits DEFAULT(false), MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); typedef u_int32_t (*encryptFunc_t)(u_int32_t, u_int32_t, u_int8_t*, u_int32_t*, u_int8_t **); MP4TrackId MP4EncAndCopyTrack( MP4FileHandle srcFile, MP4TrackId srcTrackId, mp4v2_ismacrypParams *icPp, encryptFunc_t encfcnp, u_int32_t encfcnparam1, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), bool applyEdits DEFAULT(false), MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); void MP4DeleteTrack( MP4FileHandle hFile, MP4TrackId trackId); u_int32_t MP4GetNumberOfTracks( MP4FileHandle hFile, const char* type DEFAULT(NULL), u_int8_t subType DEFAULT(0)); MP4TrackId MP4FindTrackId( MP4FileHandle hFile, u_int16_t index, const char* type DEFAULT(NULL), u_int8_t subType DEFAULT(0)); u_int16_t MP4FindTrackIndex( MP4FileHandle hFile, MP4TrackId trackId); /* track properties */ /* specific track properties */ bool MP4HaveTrackAtom(MP4FileHandle hFile, MP4TrackId trackId, const char *atomname); const char* MP4GetTrackType( MP4FileHandle hFile, MP4TrackId trackId); const char *MP4GetTrackMediaDataName(MP4FileHandle hFile, MP4TrackId trackId); // MP4GetTrackMediaDataOriginalFormat is to be used to get the original // MediaDataName if a track has been encrypted. bool MP4GetTrackMediaDataOriginalFormat(MP4FileHandle hFile, MP4TrackId trackId, char *originalFormat, u_int32_t buflen); MP4Duration MP4GetTrackDuration( MP4FileHandle hFile, MP4TrackId trackId); u_int32_t MP4GetTrackTimeScale( MP4FileHandle hFile, MP4TrackId trackId); void MP4SetTrackTimeScale( MP4FileHandle hFile, MP4TrackId trackId, u_int32_t value); u_int8_t MP4GetTrackAudioMpeg4Type( MP4FileHandle hFile, MP4TrackId trackId); u_int8_t MP4GetTrackEsdsObjectTypeId( MP4FileHandle hFile, MP4TrackId trackId); /* returns MP4_INVALID_DURATION if track samples do not have a fixed duration */ MP4Duration MP4GetTrackFixedSampleDuration( MP4FileHandle hFile, MP4TrackId trackId); u_int32_t MP4GetTrackBitRate( MP4FileHandle hFile, MP4TrackId trackId); bool MP4GetTrackVideoMetadata(MP4FileHandle hFile, MP4TrackId trackId, uint8_t **ppConfig, uint32_t *pConfigSize); bool MP4GetTrackESConfiguration( MP4FileHandle hFile, MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize); bool MP4SetTrackESConfiguration( MP4FileHandle hFile, MP4TrackId trackId, const u_int8_t* pConfig, u_int32_t configSize); /* h264 information routines */ bool MP4GetTrackH264ProfileLevel(MP4FileHandle hFile, MP4TrackId trackId, uint8_t *pProfile, uint8_t *pLevel); void MP4GetTrackH264SeqPictHeaders(MP4FileHandle hFile, MP4TrackId trackId, uint8_t ***pSeqHeaders, uint32_t **pSeqHeaderSize, uint8_t ***pPictHeader, uint32_t **pPictHeaderSize); bool MP4GetTrackH264LengthSize(MP4FileHandle hFile, MP4TrackId trackId, uint32_t *pLength); MP4SampleId MP4GetTrackNumberOfSamples( MP4FileHandle hFile, MP4TrackId trackId); u_int16_t MP4GetTrackVideoWidth( MP4FileHandle hFile, MP4TrackId trackId); u_int16_t MP4GetTrackVideoHeight( MP4FileHandle hFile, MP4TrackId trackId); double MP4GetTrackVideoFrameRate( MP4FileHandle hFile, MP4TrackId trackId); int MP4GetTrackAudioChannels(MP4FileHandle hFile, MP4TrackId trackId); bool MP4IsIsmaCrypMediaTrack( MP4FileHandle hFile, MP4TrackId trackId); /* generic track properties */ bool MP4HaveTrackAtom(MP4FileHandle hFile, MP4TrackId trackId, const char *atomName); bool MP4GetTrackIntegerProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, u_int64_t *retvalue); bool MP4GetTrackFloatProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, float *ret_value); bool MP4GetTrackStringProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const char **retvalue); bool MP4GetTrackBytesProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, u_int8_t** ppValue, u_int32_t* pValueSize); bool MP4SetTrackIntegerProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, int64_t value); bool MP4SetTrackFloatProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, float value); bool MP4SetTrackStringProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const char* value); bool MP4SetTrackBytesProperty( MP4FileHandle hFile, MP4TrackId trackId, const char* propName, const u_int8_t* pValue, u_int32_t valueSize); /* sample operations */ bool MP4ReadSample( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, /* input/output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, /* output parameters */ MP4Timestamp* pStartTime DEFAULT(NULL), MP4Duration* pDuration DEFAULT(NULL), MP4Duration* pRenderingOffset DEFAULT(NULL), bool* pIsSyncSample DEFAULT(NULL)); /* uses (unedited) time to specify sample instead of sample id */ bool MP4ReadSampleFromTime( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, /* input/output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, /* output parameters */ MP4Timestamp* pStartTime DEFAULT(NULL), MP4Duration* pDuration DEFAULT(NULL), MP4Duration* pRenderingOffset DEFAULT(NULL), bool* pIsSyncSample DEFAULT(NULL)); bool MP4WriteSample( MP4FileHandle hFile, MP4TrackId trackId, const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration DEFAULT(MP4_INVALID_DURATION), MP4Duration renderingOffset DEFAULT(0), bool isSyncSample DEFAULT(true)); bool MP4CopySample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID), MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); bool MP4EncAndCopySample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, encryptFunc_t encfcnp, u_int32_t encfcnparam1, MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID), MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); /* Note this function is not yet implemented */ bool MP4ReferenceSample( MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile, MP4TrackId dstTrackId, MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); u_int32_t MP4GetSampleSize( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId); u_int32_t MP4GetTrackMaxSampleSize( MP4FileHandle hFile, MP4TrackId trackId); MP4SampleId MP4GetSampleIdFromTime( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, bool wantSyncSample DEFAULT(false)); MP4Timestamp MP4GetSampleTime( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId); MP4Duration MP4GetSampleDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId); MP4Duration MP4GetSampleRenderingOffset( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId); bool MP4SetSampleRenderingOffset( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, MP4Duration renderingOffset); int8_t MP4GetSampleSync( MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId); /* rtp hint track operations */ bool MP4GetHintTrackRtpPayload( MP4FileHandle hFile, MP4TrackId hintTrackId, char** ppPayloadName DEFAULT(NULL), u_int8_t* pPayloadNumber DEFAULT(NULL), u_int16_t* pMaxPayloadSize DEFAULT(NULL), char **ppEncodingParams DEFAULT(NULL)); #define MP4_SET_DYNAMIC_PAYLOAD 0xff bool MP4SetHintTrackRtpPayload( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* pPayloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize DEFAULT(0), const char *encode_params DEFAULT(NULL), bool include_rtp_map DEFAULT(true), bool include_mpeg4_esid DEFAULT(true)); const char* MP4GetSessionSdp( MP4FileHandle hFile); bool MP4SetSessionSdp( MP4FileHandle hFile, const char* sdpString); bool MP4AppendSessionSdp( MP4FileHandle hFile, const char* sdpString); const char* MP4GetHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId); bool MP4SetHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* sdpString); bool MP4AppendHintTrackSdp( MP4FileHandle hFile, MP4TrackId hintTrackId, const char* sdpString); MP4TrackId MP4GetHintTrackReferenceTrackId( MP4FileHandle hFile, MP4TrackId hintTrackId); bool MP4ReadRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4SampleId hintSampleId, u_int16_t* pNumPackets DEFAULT(NULL)); u_int16_t MP4GetRtpHintNumberOfPackets( MP4FileHandle hFile, MP4TrackId hintTrackId); int8_t MP4GetRtpPacketBFrame( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex); int32_t MP4GetRtpPacketTransmitOffset( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex); bool MP4ReadRtpPacket( MP4FileHandle hFile, MP4TrackId hintTrackId, u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc DEFAULT(0), bool includeHeader DEFAULT(true), bool includePayload DEFAULT(true)); MP4Timestamp MP4GetRtpTimestampStart( MP4FileHandle hFile, MP4TrackId hintTrackId); bool MP4SetRtpTimestampStart( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4Timestamp rtpStart); bool MP4AddRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId); bool MP4AddRtpVideoHint( MP4FileHandle hFile, MP4TrackId hintTrackId, bool isBframe DEFAULT(false), u_int32_t timestampOffset DEFAULT(0)); bool MP4AddRtpPacket( MP4FileHandle hFile, MP4TrackId hintTrackId, bool setMbit DEFAULT(false), int32_t transmitOffset DEFAULT(0)); bool MP4AddRtpImmediateData( MP4FileHandle hFile, MP4TrackId hintTrackId, const u_int8_t* pBytes, u_int32_t numBytes); bool MP4AddRtpSampleData( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength); bool MP4AddRtpESConfigurationPacket( MP4FileHandle hFile, MP4TrackId hintTrackId); bool MP4WriteRtpHint( MP4FileHandle hFile, MP4TrackId hintTrackId, MP4Duration duration, bool isSyncSample DEFAULT(true)); /* 3GP specific utilities */ bool MP4Make3GPCompliant( const char* fileName, u_int32_t verbosity DEFAULT(0), char* majorBrand DEFAULT(0), u_int32_t minorVersion DEFAULT(0), char** supportedBrands DEFAULT(NULL), u_int32_t supportedBrandsCount DEFAULT(0), bool deleteIodsAtom DEFAULT(true)); /* ISMA specific utilities */ bool MP4MakeIsmaCompliant(const char* fileName, u_int32_t verbosity DEFAULT(0), bool addIsmaComplianceSdp DEFAULT(true)); char* MP4MakeIsmaSdpIod( u_int8_t videoProfile, u_int32_t videoBitrate, u_int8_t* videoConfig, u_int32_t videoConfigLength, u_int8_t audioProfile, u_int32_t audioBitrate, u_int8_t* audioConfig, u_int32_t audioConfigLength, u_int32_t verbosity DEFAULT(0)); /* edit list */ /* NOTE this section of functionality * has not yet been fully tested */ MP4EditId MP4AddTrackEdit( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID), MP4Timestamp startTime DEFAULT(0), MP4Duration duration DEFAULT(0), bool dwell DEFAULT(false)); bool MP4DeleteTrackEdit( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId); u_int32_t MP4GetTrackNumberOfEdits( MP4FileHandle hFile, MP4TrackId trackId); MP4Timestamp MP4GetTrackEditStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId); MP4Duration MP4GetTrackEditTotalDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID)); MP4Timestamp MP4GetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId); bool MP4SetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime); MP4Duration MP4GetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId); bool MP4SetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Duration duration); int8_t MP4GetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId); bool MP4SetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, bool dwell); bool MP4ReadSampleFromEditTime( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, /* input/output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, /* output parameters */ MP4Timestamp* pStartTime DEFAULT(NULL), MP4Duration* pDuration DEFAULT(NULL), MP4Duration* pRenderingOffset DEFAULT(NULL), bool* pIsSyncSample DEFAULT(NULL)); MP4SampleId MP4GetSampleIdFromEditTime( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, MP4Timestamp* pStartTime DEFAULT(NULL), MP4Duration* pDuration DEFAULT(NULL)); /* iTunes metadata handling */ bool MP4MetadataDelete(MP4FileHandle hFile); bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, char** ppName, // need to free memory u_int8_t** ppValue, // need to free u_int32_t* pValueSize); bool MP4SetMetadataName(MP4FileHandle hFile, const char* value); bool MP4GetMetadataName(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataName(MP4FileHandle hFile); bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value); bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataArtist(MP4FileHandle hFile); bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value); bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataWriter(MP4FileHandle hFile); bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value); bool MP4GetMetadataComment(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataComment(MP4FileHandle hFile); bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value); bool MP4GetMetadataTool(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataTool(MP4FileHandle hFile); bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value); bool MP4GetMetadataYear(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataYear(MP4FileHandle hFile); bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value); bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataAlbum(MP4FileHandle hFile); bool MP4SetMetadataTrack(MP4FileHandle hFile, u_int16_t track, u_int16_t totalTracks); bool MP4GetMetadataTrack(MP4FileHandle hFile, u_int16_t* track, u_int16_t* totalTracks); bool MP4DeleteMetadataTrack(MP4FileHandle hFile); bool MP4SetMetadataDisk(MP4FileHandle hFile, u_int16_t disk, u_int16_t totalDisks); bool MP4GetMetadataDisk(MP4FileHandle hFile, u_int16_t* disk, u_int16_t* totalDisks); bool MP4DeleteMetadataDisk(MP4FileHandle hFile); bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre); bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre); bool MP4DeleteMetadataGenre(MP4FileHandle hFile); bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping); bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping); bool MP4DeleteMetadataGrouping(MP4FileHandle hFile); bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo); bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo); bool MP4DeleteMetadataTempo(MP4FileHandle hFile); bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl); bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl); bool MP4DeleteMetadataCompilation(MP4FileHandle hFile); bool MP4SetMetadataPartOfGaplessAlbum(MP4FileHandle hFile, uint8_t pgap); bool MP4GetMetadataPartOfGaplessAlbum(MP4FileHandle hFile, uint8_t *pgap); bool MP4DeleteMetadataPartOfGaplessAlbum(MP4FileHandle hFile); bool MP4SetMetadataCoverArt(MP4FileHandle hFile, u_int8_t *coverArt, u_int32_t size); bool MP4GetMetadataCoverArt(MP4FileHandle hFile, u_int8_t **coverArt, u_int32_t* size, uint32_t index DEFAULT(0)); u_int32_t MP4GetMetadataCoverArtCount(MP4FileHandle hFile); bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile); bool MP4SetMetadataAlbumArtist(MP4FileHandle hFile, const char* value); bool MP4GetMetadataAlbumArtist(MP4FileHandle hFile, char** value); bool MP4DeleteMetadataAlbumArtist(MP4FileHandle hFile); bool MP4SetMetadataFreeForm(MP4FileHandle hFile, const char *name, const u_int8_t* pValue, u_int32_t valueSize, const char *owner DEFAULT(NULL)); bool MP4GetMetadataFreeForm(MP4FileHandle hFile, const char *name, u_int8_t** pValue, u_int32_t* valueSize, const char *owner DEFAULT(NULL)); bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, const char *name, const char *owner DEFAULT(NULL)); /* time conversion utilties */ /* predefined values for timeScale parameter below */ #define MP4_SECONDS_TIME_SCALE 1 #define MP4_MILLISECONDS_TIME_SCALE 1000 #define MP4_MICROSECONDS_TIME_SCALE 1000000 #define MP4_NANOSECONDS_TIME_SCALE 1000000000 #define MP4_SECS_TIME_SCALE MP4_SECONDS_TIME_SCALE #define MP4_MSECS_TIME_SCALE MP4_MILLISECONDS_TIME_SCALE #define MP4_USECS_TIME_SCALE MP4_MICROSECONDS_TIME_SCALE #define MP4_NSECS_TIME_SCALE MP4_NANOSECONDS_TIME_SCALE u_int64_t MP4ConvertFromMovieDuration( MP4FileHandle hFile, MP4Duration duration, u_int32_t timeScale); u_int64_t MP4ConvertFromTrackTimestamp( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp timeStamp, u_int32_t timeScale); MP4Timestamp MP4ConvertToTrackTimestamp( MP4FileHandle hFile, MP4TrackId trackId, u_int64_t timeStamp, u_int32_t timeScale); u_int64_t MP4ConvertFromTrackDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4Duration duration, u_int32_t timeScale); MP4Duration MP4ConvertToTrackDuration( MP4FileHandle hFile, MP4TrackId trackId, u_int64_t duration, u_int32_t timeScale); char* MP4BinaryToBase16( const u_int8_t* pData, u_int32_t dataSize); char* MP4BinaryToBase64( const u_int8_t* pData, u_int32_t dataSize); uint8_t *Base64ToBinary(const char *pData, uint32_t decodeSize, uint32_t *pDataSize); void MP4Free(void *p); void MP4SetLibFunc(lib_message_func_t libfunc); #ifdef __cplusplus } #endif /* undefined our utlity macro to avoid conflicts */ #undef DEFAULT #endif /* __MP4_INCLUDED__ */ faac-1.28/common/mp4v2/mp4array.h0000644010307701030770000000647211136736372020236 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_ARRAY_INCLUDED__ #define __MP4_ARRAY_INCLUDED__ typedef u_int32_t MP4ArrayIndex; class MP4Array { public: MP4Array() { m_numElements = 0; m_maxNumElements = 0; } inline bool ValidIndex(MP4ArrayIndex index) { if (m_numElements == 0 || index > m_numElements - 1) { return false; } return true; } inline MP4ArrayIndex Size(void) { return m_numElements; } inline MP4ArrayIndex MaxSize(void) { return m_maxNumElements; } protected: MP4ArrayIndex m_numElements; MP4ArrayIndex m_maxNumElements; }; // macro to generate subclasses // we use this as an alternative to templates // due to the excessive compile time price of extensive template usage #define MP4ARRAY_DECL(name, type) \ class name##Array : public MP4Array { \ public: \ name##Array() { \ m_elements = NULL; \ } \ \ ~name##Array() { \ MP4Free(m_elements); \ } \ \ inline void Add(type newElement) { \ Insert(newElement, m_numElements); \ } \ \ void Insert(type newElement, MP4ArrayIndex newIndex) { \ if (newIndex > m_numElements) { \ throw new MP4Error(ERANGE, "MP4Array::Insert"); \ } \ if (m_numElements == m_maxNumElements) { \ m_maxNumElements = MAX(m_maxNumElements, 1) * 2; \ m_elements = (type*)MP4Realloc(m_elements, \ m_maxNumElements * sizeof(type)); \ } \ memmove(&m_elements[newIndex + 1], &m_elements[newIndex], \ (m_numElements - newIndex) * sizeof(type)); \ m_elements[newIndex] = newElement; \ m_numElements++; \ } \ \ void Delete(MP4ArrayIndex index) { \ if (!ValidIndex(index)) { \ throw new MP4Error(ERANGE, "MP4Array::Delete"); \ } \ m_numElements--; \ if (index < m_numElements) { \ memmove(&m_elements[index], &m_elements[index + 1], \ (m_numElements - index) * sizeof(type)); \ } \ } \ void Resize(MP4ArrayIndex newSize) { \ m_numElements = newSize; \ m_maxNumElements = newSize; \ m_elements = (type*)MP4Realloc(m_elements, \ m_maxNumElements * sizeof(type)); \ } \ \ type& operator[](MP4ArrayIndex index) { \ if (!ValidIndex(index)) { \ throw new MP4Error(ERANGE, "index %u of %u", "MP4Array::[]", index, m_numElements); \ } \ return m_elements[index]; \ } \ \ protected: \ type* m_elements; \ }; MP4ARRAY_DECL(MP4Integer8, u_int8_t) MP4ARRAY_DECL(MP4Integer16, u_int16_t) MP4ARRAY_DECL(MP4Integer32, u_int32_t) MP4ARRAY_DECL(MP4Integer64, u_int64_t) MP4ARRAY_DECL(MP4Float32, float) MP4ARRAY_DECL(MP4Float64, double) MP4ARRAY_DECL(MP4String, char*) MP4ARRAY_DECL(MP4Bytes, u_int8_t*) #endif /* __MP4_ARRAY_INCLUDED__ */ faac-1.28/common/mp4v2/mp4atom.cpp0000644010307701030770000005542711136736372020417 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Portions created by Adnecto d.o.o. are * Copyright (C) Adnecto d.o.o. 2005. All Rights Reserved * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com * Danijel Kopcinovic danijel.kopcinovic@adnecto.net */ #include "mp4common.h" #include "atoms.h" MP4AtomInfo::MP4AtomInfo(const char* name, bool mandatory, bool onlyOne) { m_name = name; m_mandatory = mandatory; m_onlyOne = onlyOne; m_count = 0; } MP4Atom::MP4Atom(const char* type) { SetType(type); m_unknownType = FALSE; m_pFile = NULL; m_start = 0; m_end = 0; m_size = 0; m_pParentAtom = NULL; m_depth = 0xFF; } MP4Atom::~MP4Atom() { u_int32_t i; for (i = 0; i < m_pProperties.Size(); i++) { delete m_pProperties[i]; } for (i = 0; i < m_pChildAtomInfos.Size(); i++) { delete m_pChildAtomInfos[i]; } for (i = 0; i < m_pChildAtoms.Size(); i++) { delete m_pChildAtoms[i]; } } MP4Atom* MP4Atom::CreateAtom(const char* type) { MP4Atom* pAtom = NULL; if (type == NULL) { pAtom = new MP4RootAtom(); } else { switch((uint8_t)type[0]) { case 'a': if (ATOMID(type) == ATOMID("avc1")) { pAtom = new MP4Avc1Atom(); } else if (ATOMID(type) == ATOMID("avcC")) { pAtom = new MP4AvcCAtom(); } else if (ATOMID(type) == ATOMID("alis")) { pAtom = new MP4UrlAtom("alis"); } else if (ATOMID(type) == ATOMID("alaw")) { pAtom = new MP4SoundAtom(type); } else if (ATOMID(type) == ATOMID("alac")) { pAtom = new MP4SoundAtom(type); } break; case 'c': if (ATOMID(type) == ATOMID("chap")) { pAtom = new MP4TrefTypeAtom(type); } break; case 'd': if (ATOMID(type) == ATOMID("d263")) { pAtom = new MP4D263Atom(); } else if (ATOMID(type) == ATOMID("damr")) { pAtom = new MP4DamrAtom(); } else if (ATOMID(type) == ATOMID("dref")) { pAtom = new MP4DrefAtom(); } else if (ATOMID(type) == ATOMID("dpnd")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ pAtom = new MP4DataAtom(); } break; case 'e': if (ATOMID(type) == ATOMID("elst")) { pAtom = new MP4ElstAtom(); } else if (ATOMID(type) == ATOMID("enca")) { pAtom = new MP4EncaAtom(); } else if (ATOMID(type) == ATOMID("encv")) { pAtom = new MP4EncvAtom(); } break; case 'f': if (ATOMID(type) == ATOMID("free")) { pAtom = new MP4FreeAtom(); } else if (ATOMID(type) == ATOMID("ftyp")) { pAtom = new MP4FtypAtom(); } break; case 'g': if (ATOMID(type) == ATOMID("gmin")) { pAtom = new MP4GminAtom(); } break; case 'h': if (ATOMID(type) == ATOMID("hdlr")) { pAtom = new MP4HdlrAtom(); } else if (ATOMID(type) == ATOMID("hint")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("hnti")) { pAtom = new MP4HntiAtom(); } else if (ATOMID(type) == ATOMID("hinf")) { pAtom = new MP4HinfAtom(); } else if (ATOMID(type) == ATOMID("h263")) { pAtom = new MP4VideoAtom("h263"); } else if (ATOMID(type) == ATOMID("href")) { pAtom = new MP4HrefAtom(); } break; case 'i': if (ATOMID(type) == ATOMID("ipir")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("ima4")) { pAtom = new MP4SoundAtom("ima4"); } break; case 'j': if (ATOMID(type) == ATOMID("jpeg")) { pAtom = new MP4VideoAtom("jpeg"); } break; case 'm': if (ATOMID(type) == ATOMID("mdhd")) { pAtom = new MP4MdhdAtom(); } else if (ATOMID(type) == ATOMID("mvhd")) { pAtom = new MP4MvhdAtom(); } else if (ATOMID(type) == ATOMID("mdat")) { pAtom = new MP4MdatAtom(); } else if (ATOMID(type) == ATOMID("mpod")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("mp4a")) { pAtom = new MP4SoundAtom("mp4a"); } else if (ATOMID(type) == ATOMID("mp4s")) { pAtom = new MP4Mp4sAtom(); } else if (ATOMID(type) == ATOMID("mp4v")) { pAtom = new MP4Mp4vAtom(); } else if (ATOMID(type) == ATOMID("mean")) { // iTunes pAtom = new MP4Meta1Atom(type); } break; case 'n': if (ATOMID(type) == ATOMID("name")) { // iTunes pAtom = new MP4Meta1Atom(type); } break; case 'o': if (ATOMID(type) == ATOMID("ohdr")) { pAtom = new MP4OhdrAtom(); } break; case 'r': if (ATOMID(type) == ATOMID("rtp ")) { pAtom = new MP4RtpAtom(); } else if (ATOMID(type) == ATOMID("raw ")) { pAtom = new MP4VideoAtom("raw "); } break; case 's': if (ATOMID(type) == ATOMID("s263")) { pAtom = new MP4S263Atom(); } else if (ATOMID(type) == ATOMID("samr")) { pAtom = new MP4AmrAtom("samr"); } else if (ATOMID(type) == ATOMID("sawb")) { pAtom = new MP4AmrAtom("sawb"); } else if (ATOMID(type) == ATOMID("stbl")) { pAtom = new MP4StblAtom(); } else if (ATOMID(type) == ATOMID("stsd")) { pAtom = new MP4StsdAtom(); } else if (ATOMID(type) == ATOMID("stsz")) { pAtom = new MP4StszAtom(); } else if (ATOMID(type) == ATOMID("stsc")) { pAtom = new MP4StscAtom(); } else if (ATOMID(type) == ATOMID("stz2")) { pAtom = new MP4Stz2Atom(); } else if (ATOMID(type) == ATOMID("stdp")) { pAtom = new MP4StdpAtom(); } else if (ATOMID(type) == ATOMID("sdp ")) { pAtom = new MP4SdpAtom(); } else if (ATOMID(type) == ATOMID("sync")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("skip")) { pAtom = new MP4FreeAtom(); pAtom->SetType("skip"); } else if (ATOMID(type) == ATOMID("sowt")) { pAtom = new MP4SoundAtom("sowt"); } break; case 't': if (ATOMID(type) == ATOMID("text")) { pAtom = new MP4TextAtom(); } else if (ATOMID(type) == ATOMID("tkhd")) { pAtom = new MP4TkhdAtom(); } else if (ATOMID(type) == ATOMID("tfhd")) { pAtom = new MP4TfhdAtom(); } else if (ATOMID(type) == ATOMID("trun")) { pAtom = new MP4TrunAtom(); } else if (ATOMID(type) == ATOMID("twos")) { pAtom = new MP4SoundAtom("twos"); } break; case 'u': if (ATOMID(type) == ATOMID("udta")) { pAtom = new MP4UdtaAtom(); } else if (ATOMID(type) == ATOMID("url ")) { pAtom = new MP4UrlAtom(); } else if (ATOMID(type) == ATOMID("urn ")) { pAtom = new MP4UrnAtom(); } else if (ATOMID(type) == ATOMID("ulaw")) { pAtom = new MP4SoundAtom("ulaw"); } break; case 'v': if (ATOMID(type) == ATOMID("vmhd")) { pAtom = new MP4VmhdAtom(); } break; case 'y': if (ATOMID(type) == ATOMID("yuv2")) { pAtom = new MP4VideoAtom("yuv2"); } break; case 'S': if (ATOMID(type) == ATOMID("SVQ3")) { pAtom = new MP4VideoAtom("SVQ3"); } else if (ATOMID(type) == ATOMID("SMI ")) { pAtom = new MP4SmiAtom(); } break; case 0251: static const char name[5]={0251,'n', 'a', 'm', '\0'}; static const char cmt[5]={0251,'c', 'm', 't', '\0'}; static const char cpy[5]={0251,'c', 'p', 'y', '\0'}; static const char des[5]={0251,'d', 'e', 's','\0'}; static const char prd[5]={0251, 'p', 'r', 'd', '\0'}; if (ATOMID(type) == ATOMID(name) || ATOMID(type) == ATOMID(cmt) || ATOMID(type) == ATOMID(cpy) || ATOMID(type) == ATOMID(prd) || ATOMID(type) == ATOMID(des)) { pAtom = new MP4Meta2Atom(type); } break; } } if (pAtom == NULL) { pAtom = new MP4StandardAtom(type); // unknown type is set by StandardAtom type } ASSERT(pAtom); return pAtom; } // generate a skeletal self void MP4Atom::Generate() { u_int32_t i; // for all properties for (i = 0; i < m_pProperties.Size(); i++) { // ask it to self generate m_pProperties[i]->Generate(); } // for all mandatory, single child atom types for (i = 0; i < m_pChildAtomInfos.Size(); i++) { if (m_pChildAtomInfos[i]->m_mandatory && m_pChildAtomInfos[i]->m_onlyOne) { // create the mandatory, single child atom MP4Atom* pChildAtom = CreateAtom(m_pChildAtomInfos[i]->m_name); AddChildAtom(pChildAtom); // and ask it to self generate pChildAtom->Generate(); } } } MP4Atom* MP4Atom::ReadAtom(MP4File* pFile, MP4Atom* pParentAtom) { u_int8_t hdrSize = 8; u_int8_t extendedType[16]; u_int64_t pos = pFile->GetPosition(); VERBOSE_READ(pFile->GetVerbosity(), printf("ReadAtom: pos = 0x"X64"\n", pos)); u_int64_t dataSize = pFile->ReadUInt32(); char type[5]; pFile->ReadBytes((u_int8_t*)&type[0], 4); type[4] = '\0'; // extended size if (dataSize == 1) { dataSize = pFile->ReadUInt64(); hdrSize += 8; pFile->Check64BitStatus(type); } // extended type if (ATOMID(type) == ATOMID("uuid")) { pFile->ReadBytes(extendedType, sizeof(extendedType)); hdrSize += sizeof(extendedType); } if (dataSize == 0) { // extends to EOF dataSize = pFile->GetSize() - pos; } dataSize -= hdrSize; VERBOSE_READ(pFile->GetVerbosity(), printf("ReadAtom: type = \"%s\" data-size = "U64" (0x"X64") hdr %u\n", type, dataSize, dataSize, hdrSize)); if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { VERBOSE_ERROR(pFile->GetVerbosity(), printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of \"%s\" \"%s\" "U64" vs "U64"\n", pParentAtom->GetType(), type, pos + hdrSize + dataSize, pParentAtom->GetEnd())); VERBOSE_READ(pFile->GetVerbosity(), printf("parent %s ("U64") pos "U64" hdr %d data "U64" sum "U64"\n", pParentAtom->GetType(), pParentAtom->GetEnd(), pos, hdrSize, dataSize, pos + hdrSize + dataSize)); #if 0 throw new MP4Error("invalid atom size", "ReadAtom"); #else // skip to end of atom dataSize = pParentAtom->GetEnd() - pos - hdrSize; #endif } MP4Atom* pAtom = CreateAtom(type); pAtom->SetFile(pFile); pAtom->SetStart(pos); pAtom->SetEnd(pos + hdrSize + dataSize); pAtom->SetSize(dataSize); if (ATOMID(type) == ATOMID("uuid")) { pAtom->SetExtendedType(extendedType); } if (pAtom->IsUnknownType()) { if (!IsReasonableType(pAtom->GetType())) { VERBOSE_READ(pFile->GetVerbosity(), printf("Warning: atom type %s is suspect\n", pAtom->GetType())); } else { VERBOSE_READ(pFile->GetVerbosity(), printf("Info: atom type %s is unknown\n", pAtom->GetType())); } if (dataSize > 0) { pAtom->AddProperty( new MP4BytesProperty("data", dataSize)); } } pAtom->SetParentAtom(pParentAtom); pAtom->Read(); return pAtom; } bool MP4Atom::IsReasonableType(const char* type) { for (u_int8_t i = 0; i < 4; i++) { if (isalnum(type[i])) { continue; } if (i == 3 && type[i] == ' ') { continue; } return false; } return true; } // generic read void MP4Atom::Read() { ASSERT(m_pFile); if (ATOMID(m_type) != 0 && m_size > 1000000) { VERBOSE_READ(GetVerbosity(), printf("Warning: %s atom size "U64" is suspect\n", m_type, m_size)); } ReadProperties(); // read child atoms, if we expect there to be some if (m_pChildAtomInfos.Size() > 0) { ReadChildAtoms(); } Skip(); // to end of atom } void MP4Atom::Skip() { if (m_pFile->GetPosition() != m_end) { VERBOSE_READ(m_pFile->GetVerbosity(), printf("Skip: "U64" bytes\n", m_end - m_pFile->GetPosition())); } m_pFile->SetPosition(m_end); } MP4Atom* MP4Atom::FindAtom(const char* name) { if (!IsMe(name)) { return NULL; } if (!IsRootAtom()) { VERBOSE_FIND(m_pFile->GetVerbosity(), printf("FindAtom: matched %s\n", name)); name = MP4NameAfterFirst(name); // I'm the sought after atom if (name == NULL) { return this; } } // else it's one of my children return FindChildAtom(name); } bool MP4Atom::FindProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!IsMe(name)) { return false; } if (!IsRootAtom()) { VERBOSE_FIND(m_pFile->GetVerbosity(), printf("FindProperty: matched %s\n", name)); name = MP4NameAfterFirst(name); // no property name given if (name == NULL) { return false; } } return FindContainedProperty(name, ppProperty, pIndex); } bool MP4Atom::IsMe(const char* name) { if (name == NULL) { return false; } // root atom always matches if (!strcmp(m_type, "")) { return true; } // check if our atom name is specified as the first component if (!MP4NameFirstMatches(m_type, name)) { return false; } return true; } MP4Atom* MP4Atom::FindChildAtom(const char* name) { u_int32_t atomIndex = 0; // get the index if we have one, e.g. moov.trak[2].mdia... (void)MP4NameFirstIndex(name, &atomIndex); // need to get to the index'th child atom of the right type for (u_int32_t i = 0; i < m_pChildAtoms.Size(); i++) { if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) { if (atomIndex == 0) { // this is the one, ask it to match return m_pChildAtoms[i]->FindAtom(name); } atomIndex--; } } return NULL; } bool MP4Atom::FindContainedProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { u_int32_t numProperties = m_pProperties.Size(); u_int32_t i; // check all of our properties for (i = 0; i < numProperties; i++) { if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { return true; } } // not one of our properties, // presumably one of our children's properties // check child atoms... // check if we have an index, e.g. trak[2].mdia... u_int32_t atomIndex = 0; (void)MP4NameFirstIndex(name, &atomIndex); // need to get to the index'th child atom of the right type for (i = 0; i < m_pChildAtoms.Size(); i++) { if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) { if (atomIndex == 0) { // this is the one, ask it to match return m_pChildAtoms[i]->FindProperty(name, ppProperty, pIndex); } atomIndex--; } } VERBOSE_FIND(m_pFile->GetVerbosity(), printf("FindProperty: no match for %s\n", name)); return false; } void MP4Atom::ReadProperties(u_int32_t startIndex, u_int32_t count) { u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex); // read any properties of the atom for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) { m_pProperties[i]->Read(m_pFile); if (m_pFile->GetPosition() > m_end) { VERBOSE_READ(GetVerbosity(), printf("ReadProperties: insufficient data for property: %s pos 0x"X64" atom end 0x"X64"\n", m_pProperties[i]->GetName(), m_pFile->GetPosition(), m_end)); throw new MP4Error("atom is too small", "Atom ReadProperties"); } if (m_pProperties[i]->GetType() == TableProperty) { VERBOSE_READ_TABLE(GetVerbosity(), printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true)); } else if (m_pProperties[i]->GetType() != DescriptorProperty) { VERBOSE_READ(GetVerbosity(), printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true)); } } } void MP4Atom::ReadChildAtoms() { bool this_is_udta = ATOMID(m_type) == ATOMID("udta"); VERBOSE_READ(GetVerbosity(), printf("ReadChildAtoms: of %s\n", m_type[0] ? m_type : "root")); for (u_int64_t position = m_pFile->GetPosition(); position < m_end; position = m_pFile->GetPosition()) { // make sure that we have enough to read at least 8 bytes // size and type. if (m_end - position < 2 * sizeof(uint32_t)) { // if we're reading udta, it's okay to have 4 bytes of 0 if (this_is_udta && m_end - position == sizeof(uint32_t)) { u_int32_t mbz = m_pFile->ReadUInt32(); if (mbz != 0) { VERBOSE_WARNING(GetVerbosity(), printf("Error: In udta atom, end value is not zero %x\n", mbz)); } continue; } // otherwise, output a warning, but don't care VERBOSE_WARNING(GetVerbosity(), printf("Error: In %s atom, extra "D64" bytes at end of atom\n", m_type, (m_end - position))); for (uint64_t ix = 0; ix < m_end - position; ix++) { (void)m_pFile->ReadUInt8(); } continue; } MP4Atom* pChildAtom = MP4Atom::ReadAtom(m_pFile, this); AddChildAtom(pChildAtom); MP4AtomInfo* pChildAtomInfo = FindAtomInfo(pChildAtom->GetType()); // if child atom is of known type // but not expected here print warning if (pChildAtomInfo == NULL && !pChildAtom->IsUnknownType()) { VERBOSE_READ(GetVerbosity(), printf("Warning: In atom %s unexpected child atom %s\n", GetType(), pChildAtom->GetType())); } // if child atoms should have just one instance // and this is more than one, print warning if (pChildAtomInfo) { pChildAtomInfo->m_count++; if (pChildAtomInfo->m_onlyOne && pChildAtomInfo->m_count > 1) { VERBOSE_READ(GetVerbosity(), printf("Warning: In atom %s multiple child atoms %s\n", GetType(), pChildAtom->GetType())); } } } // if mandatory child atom doesn't exist, print warning u_int32_t numAtomInfo = m_pChildAtomInfos.Size(); for (u_int32_t i = 0; i < numAtomInfo; i++) { if (m_pChildAtomInfos[i]->m_mandatory && m_pChildAtomInfos[i]->m_count == 0) { VERBOSE_READ(GetVerbosity(), printf("Warning: In atom %s missing child atom %s\n", GetType(), m_pChildAtomInfos[i]->m_name)); } } VERBOSE_READ(GetVerbosity(), printf("ReadChildAtoms: finished %s\n", m_type)); } MP4AtomInfo* MP4Atom::FindAtomInfo(const char* name) { u_int32_t numAtomInfo = m_pChildAtomInfos.Size(); for (u_int32_t i = 0; i < numAtomInfo; i++) { if (ATOMID(m_pChildAtomInfos[i]->m_name) == ATOMID(name)) { return m_pChildAtomInfos[i]; } } return NULL; } // generic write void MP4Atom::Write() { ASSERT(m_pFile); BeginWrite(); WriteProperties(); WriteChildAtoms(); FinishWrite(); } void MP4Atom::Rewrite() { ASSERT(m_pFile); if (!m_end) { // This atom hasn't been written yet... return; } u_int64_t fPos = m_pFile->GetPosition(); m_pFile->SetPosition(GetStart()); Write(); m_pFile->SetPosition(fPos); } void MP4Atom::BeginWrite(bool use64) { m_start = m_pFile->GetPosition(); //use64 = m_pFile->Use64Bits(); if (use64) { m_pFile->WriteUInt32(1); } else { m_pFile->WriteUInt32(0); } m_pFile->WriteBytes((u_int8_t*)&m_type[0], 4); if (use64) { m_pFile->WriteUInt64(0); } if (ATOMID(m_type) == ATOMID("uuid")) { m_pFile->WriteBytes(m_extendedType, sizeof(m_extendedType)); } } void MP4Atom::FinishWrite(bool use64) { m_end = m_pFile->GetPosition(); m_size = (m_end - m_start); VERBOSE_WRITE(GetVerbosity(), printf("end: type %s "U64" "U64" size "U64"\n", m_type, m_start, m_end, m_size)); //use64 = m_pFile->Use64Bits(); if (use64) { m_pFile->SetPosition(m_start + 8); m_pFile->WriteUInt64(m_size); } else { ASSERT(m_size <= (u_int64_t)0xFFFFFFFF); m_pFile->SetPosition(m_start); m_pFile->WriteUInt32(m_size); } m_pFile->SetPosition(m_end); // adjust size to just reflect data portion of atom m_size -= (use64 ? 16 : 8); if (ATOMID(m_type) == ATOMID("uuid")) { m_size -= sizeof(m_extendedType); } } void MP4Atom::WriteProperties(u_int32_t startIndex, u_int32_t count) { u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex); VERBOSE_WRITE(GetVerbosity(), printf("Write: type %s\n", m_type)); for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) { m_pProperties[i]->Write(m_pFile); if (m_pProperties[i]->GetType() == TableProperty) { VERBOSE_WRITE_TABLE(GetVerbosity(), printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false)); } else { VERBOSE_WRITE(GetVerbosity(), printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false)); } } } void MP4Atom::WriteChildAtoms() { u_int32_t size = m_pChildAtoms.Size(); for (u_int32_t i = 0; i < size; i++) { m_pChildAtoms[i]->Write(); } VERBOSE_WRITE(GetVerbosity(), printf("Write: finished %s\n", m_type)); } void MP4Atom::AddProperty(MP4Property* pProperty) { ASSERT(pProperty); m_pProperties.Add(pProperty); pProperty->SetParentAtom(this); } void MP4Atom::AddVersionAndFlags() { AddProperty(new MP4Integer8Property("version")); AddProperty(new MP4Integer24Property("flags")); } void MP4Atom::AddReserved(char* name, u_int32_t size) { MP4BytesProperty* pReserved = new MP4BytesProperty(name, size); pReserved->SetReadOnly(); AddProperty(pReserved); } void MP4Atom::ExpectChildAtom(const char* name, bool mandatory, bool onlyOne) { m_pChildAtomInfos.Add(new MP4AtomInfo(name, mandatory, onlyOne)); } u_int8_t MP4Atom::GetVersion() { if (strcmp("version", m_pProperties[0]->GetName())) { return 0; } return ((MP4Integer8Property*)m_pProperties[0])->GetValue(); } void MP4Atom::SetVersion(u_int8_t version) { if (strcmp("version", m_pProperties[0]->GetName())) { return; } ((MP4Integer8Property*)m_pProperties[0])->SetValue(version); } u_int32_t MP4Atom::GetFlags() { if (strcmp("flags", m_pProperties[1]->GetName())) { return 0; } return ((MP4Integer24Property*)m_pProperties[1])->GetValue(); } void MP4Atom::SetFlags(u_int32_t flags) { if (strcmp("flags", m_pProperties[1]->GetName())) { return; } ((MP4Integer24Property*)m_pProperties[1])->SetValue(flags); } void MP4Atom::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) { if (m_type[0] != '\0') { Indent(pFile, indent); fprintf(pFile, "type %s\n", m_type); fflush(pFile); } u_int32_t i; u_int32_t size; // dump our properties size = m_pProperties.Size(); for (i = 0; i < size; i++) { /* skip details of tables unless we're told to be verbose */ if (m_pProperties[i]->GetType() == TableProperty && !(GetVerbosity() & MP4_DETAILS_TABLE)) { Indent(pFile, indent + 1); fprintf(pFile, "\n"); continue; } m_pProperties[i]->Dump(pFile, indent + 1, dumpImplicits); } // dump our children size = m_pChildAtoms.Size(); for (i = 0; i < size; i++) { m_pChildAtoms[i]->Dump(pFile, indent + 1, dumpImplicits); } } u_int32_t MP4Atom::GetVerbosity() { ASSERT(m_pFile); return m_pFile->GetVerbosity(); } u_int8_t MP4Atom::GetDepth() { if (m_depth < 0xFF) { return m_depth; } MP4Atom *pAtom = this; m_depth = 0; while ((pAtom = pAtom->GetParentAtom()) != NULL) { m_depth++; ASSERT(m_depth < 255); } return m_depth; } faac-1.28/common/mp4v2/mp4atom.h0000644010307701030770000001322411136736372020051 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #ifndef __MP4_ATOM_INCLUDED__ #define __MP4_ATOM_INCLUDED__ class MP4Atom; MP4ARRAY_DECL(MP4Atom, MP4Atom*); #define Required true #define Optional false #define OnlyOne true #define Many false #define Counted true /* helper class */ class MP4AtomInfo { public: MP4AtomInfo() { m_name = NULL; } MP4AtomInfo(const char* name, bool mandatory, bool onlyOne); const char* m_name; bool m_mandatory; bool m_onlyOne; u_int32_t m_count; }; MP4ARRAY_DECL(MP4AtomInfo, MP4AtomInfo*); class MP4Atom { public: MP4Atom(const char* type = NULL); virtual ~MP4Atom(); static MP4Atom* ReadAtom(MP4File* pFile, MP4Atom* pParentAtom); static MP4Atom* CreateAtom(const char* type); static bool IsReasonableType(const char* type); MP4File* GetFile() { return m_pFile; }; void SetFile(MP4File* pFile) { m_pFile = pFile; }; u_int64_t GetStart() { return m_start; }; void SetStart(u_int64_t pos) { m_start = pos; }; u_int64_t GetEnd() { return m_end; }; void SetEnd(u_int64_t pos) { m_end = pos; }; u_int64_t GetSize() { return m_size; } void SetSize(u_int64_t size) { m_size = size; } const char* GetType() { return m_type; }; void SetType(const char* type) { if (type && *type != '\0') { // not needed ASSERT(strlen(type) == 4); memcpy(m_type, type, 4); m_type[4] = '\0'; } else { memset(m_type, 0, 5); } } void GetExtendedType(u_int8_t* pExtendedType) { memcpy(pExtendedType, m_extendedType, sizeof(m_extendedType)); }; void SetExtendedType(u_int8_t* pExtendedType) { memcpy(m_extendedType, pExtendedType, sizeof(m_extendedType)); }; bool IsUnknownType() { return m_unknownType; } void SetUnknownType(bool unknownType = true) { m_unknownType = unknownType; } bool IsRootAtom() { return m_type[0] == '\0'; } MP4Atom* GetParentAtom() { return m_pParentAtom; } void SetParentAtom(MP4Atom* pParentAtom) { m_pParentAtom = pParentAtom; } void AddChildAtom(MP4Atom* pChildAtom) { pChildAtom->SetFile(m_pFile); pChildAtom->SetParentAtom(this); m_pChildAtoms.Add(pChildAtom); } void InsertChildAtom(MP4Atom* pChildAtom, u_int32_t index) { pChildAtom->SetFile(m_pFile); pChildAtom->SetParentAtom(this); m_pChildAtoms.Insert(pChildAtom, index); } void DeleteChildAtom(MP4Atom* pChildAtom) { for (MP4ArrayIndex i = 0; i < m_pChildAtoms.Size(); i++) { if (m_pChildAtoms[i] == pChildAtom) { m_pChildAtoms.Delete(i); return; } } } u_int32_t GetNumberOfChildAtoms() { return m_pChildAtoms.Size(); } MP4Atom* GetChildAtom(u_int32_t index) { return m_pChildAtoms[index]; } MP4Property* GetProperty(u_int32_t index) { return m_pProperties[index]; } u_int32_t GetCount() { return m_pProperties.Size(); } #if 0 void SetProperty(u_int32_t index, MP4Property *property) { u_int64_t t; if (index > m_pProperties.Size()) return; t = property->Get(index); m_pProperties[index]->Set(t, index); } #endif MP4Atom* FindAtom(const char* name); MP4Atom* FindChildAtom(const char* name); bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); u_int32_t GetFlags(); void SetFlags(u_int32_t flags); u_int8_t GetDepth(); void Skip(); virtual void Generate(); virtual void Read(); virtual void BeginWrite(bool use64 = false); virtual void Write(); virtual void Rewrite(); virtual void FinishWrite(bool use64 = false); virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); protected: void AddProperty(MP4Property* pProperty); void AddVersionAndFlags(); void AddReserved(char* name, u_int32_t size); void ExpectChildAtom(const char* name, bool mandatory, bool onlyOne = true); MP4AtomInfo* FindAtomInfo(const char* name); bool IsMe(const char* name); bool FindContainedProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex); void ReadProperties( u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); void ReadChildAtoms(); void WriteProperties( u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); void WriteChildAtoms(); u_int8_t GetVersion(); void SetVersion(u_int8_t version); /* debugging aid */ u_int32_t GetVerbosity(); protected: MP4File* m_pFile; u_int64_t m_start; u_int64_t m_end; u_int64_t m_size; char m_type[5]; bool m_unknownType; u_int8_t m_extendedType[16]; MP4Atom* m_pParentAtom; u_int8_t m_depth; MP4PropertyArray m_pProperties; MP4AtomInfoArray m_pChildAtomInfos; MP4AtomArray m_pChildAtoms; }; inline u_int32_t ATOMID(const char* type) { return STRTOINT32(type); } // inverse ATOMID - 32 bit id to string inline void IDATOM(u_int32_t type, char *s) { INT32TOSTR(type, s); } #endif /* __MP4_ATOM_INCLUDED__ */ faac-1.28/common/mp4v2/mp4common.h0000644010307701030770000000256311136736372020405 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_COMMON_INCLUDED__ #define __MP4_COMMON_INCLUDED__ // common includes for everything // with an internal view of the library // i.e. all the .cpp's just #include "mp4common.h" #include "mpeg4ip.h" #include "mp4.h" #include "mp4util.h" #include "mp4array.h" #include "mp4track.h" #include "mp4file.h" #include "mp4property.h" #include "mp4container.h" #include "mp4descriptor.h" #include "mp4atom.h" #include "atoms.h" #include "descriptors.h" #include "ocidescriptors.h" #include "qosqualifiers.h" #include "odcommands.h" #include "rtphint.h" #include "virtual_io.h" #endif /* __MP4_COMMON_INCLUDED__ */ faac-1.28/common/mp4v2/mp4container.cpp0000644010307701030770000001267210101411050021402 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Container::~MP4Container() { for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { delete m_pProperties[i]; } } void MP4Container::AddProperty(MP4Property* pProperty) { ASSERT(pProperty); m_pProperties.Add(pProperty); } bool MP4Container::FindProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { if (pIndex) { *pIndex = 0; // set the default answer for index } u_int32_t numProperties = m_pProperties.Size(); for (u_int32_t i = 0; i < numProperties; i++) { if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { return true; } } return false; } void MP4Container::FindIntegerProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property", "MP4Container::FindIntegerProperty"); } switch ((*ppProperty)->GetType()) { case Integer8Property: case Integer16Property: case Integer24Property: case Integer32Property: case Integer64Property: break; default: throw new MP4Error("type mismatch", "MP4Container::FindIntegerProperty"); } } u_int64_t MP4Container::GetIntegerProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindIntegerProperty(name, &pProperty, &index); return ((MP4IntegerProperty*)pProperty)->GetValue(index); } void MP4Container::SetIntegerProperty(const char* name, u_int64_t value) { MP4Property* pProperty = NULL; u_int32_t index = 0; FindIntegerProperty(name, &pProperty, &index); ((MP4IntegerProperty*)pProperty)->SetValue(value, index); } void MP4Container::FindFloatProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property", "MP4Container::FindFloatProperty"); } if ((*ppProperty)->GetType() != Float32Property) { throw new MP4Error("type mismatch", "MP4Container::FindFloatProperty"); } } float MP4Container::GetFloatProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindFloatProperty(name, &pProperty, &index); return ((MP4Float32Property*)pProperty)->GetValue(index); } void MP4Container::SetFloatProperty(const char* name, float value) { MP4Property* pProperty; u_int32_t index; FindFloatProperty(name, &pProperty, &index); ((MP4Float32Property*)pProperty)->SetValue(value, index); } void MP4Container::FindStringProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property", "MP4Container::FindStringProperty"); } if ((*ppProperty)->GetType() != StringProperty) { throw new MP4Error("type mismatch", "MP4Container::FindStringProperty"); } } const char* MP4Container::GetStringProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindStringProperty(name, &pProperty, &index); return ((MP4StringProperty*)pProperty)->GetValue(index); } void MP4Container::SetStringProperty(const char* name, const char* value) { MP4Property* pProperty; u_int32_t index; FindStringProperty(name, &pProperty, &index); ((MP4StringProperty*)pProperty)->SetValue(value, index); } void MP4Container::FindBytesProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property", "MP4Container::FindBytesProperty"); } if ((*ppProperty)->GetType() != BytesProperty) { throw new MP4Error("type mismatch", "MP4Container::FindBytesProperty"); } } void MP4Container::GetBytesProperty(const char* name, u_int8_t** ppValue, u_int32_t* pValueSize) { MP4Property* pProperty; u_int32_t index; FindBytesProperty(name, &pProperty, &index); ((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index); } void MP4Container::SetBytesProperty(const char* name, const u_int8_t* pValue, u_int32_t valueSize) { MP4Property* pProperty; u_int32_t index; FindBytesProperty(name, &pProperty, &index); ((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index); } void MP4Container::Read(MP4File* pFile) { u_int32_t numProperties = m_pProperties.Size(); for (u_int32_t i = 0; i < numProperties; i++) { m_pProperties[i]->Read(pFile); } } void MP4Container::Write(MP4File* pFile) { u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } for (u_int32_t i = 0; i < numProperties; i++) { m_pProperties[i]->Write(pFile); } } void MP4Container::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) { u_int32_t numProperties = m_pProperties.Size(); for (u_int32_t i = 0; i < numProperties; i++) { m_pProperties[i]->Dump(pFile, indent, dumpImplicits); } } faac-1.28/common/mp4v2/mp4container.h0000644010307701030770000000467410101411050021052 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_CONTAINER_INCLUDED__ #define __MP4_CONTAINER_INCLUDED__ // base class - container of mp4 properties class MP4Container { public: MP4Container() { } virtual ~MP4Container(); void AddProperty(MP4Property* pProperty); virtual void Read(MP4File* pFile); virtual void Write(MP4File* pFile); virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); MP4Property* GetProperty(u_int32_t index) { return m_pProperties[index]; } // LATER MP4Property* GetProperty(const char* name); throw on error // LATER MP4Property* FindProperty(const char* name, u_int32_t* pIndex = NULL); returns NULL on error bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); void FindIntegerProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); u_int64_t GetIntegerProperty(const char* name); void SetIntegerProperty(const char* name, u_int64_t value); void FindFloatProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); float GetFloatProperty(const char* name); void SetFloatProperty(const char* name, float value); void FindStringProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); const char* GetStringProperty(const char* name); void SetStringProperty(const char* name, const char* value); void FindBytesProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); void GetBytesProperty(const char* name, u_int8_t** ppValue, u_int32_t* pValueSize); void SetBytesProperty(const char* name, const u_int8_t* pValue, u_int32_t valueSize); protected: MP4PropertyArray m_pProperties; }; #endif /* __MP4_CONTAINER_INCLUDED__ */ faac-1.28/common/mp4v2/mp4descriptor.cpp0000644010307701030770000001213110101411050021564 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Descriptor::MP4Descriptor(u_int8_t tag) { m_tag = tag; m_pParentAtom = NULL; m_start = 0; m_size = 0; m_readMutatePoint = 0; } MP4Descriptor::~MP4Descriptor() { for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { delete m_pProperties[i]; } } void MP4Descriptor::AddProperty(MP4Property* pProperty) { ASSERT(pProperty); m_pProperties.Add(pProperty); pProperty->SetParentAtom(m_pParentAtom); } bool MP4Descriptor::FindContainedProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { u_int32_t numProperties = m_pProperties.Size(); for (u_int32_t i = 0; i < numProperties; i++) { if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { return true; } } return false; } void MP4Descriptor::Generate() { // generate properties for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { m_pProperties[i]->Generate(); } } void MP4Descriptor::Read(MP4File* pFile) { ReadHeader(pFile); ReadProperties(pFile, 0, m_readMutatePoint); Mutate(); ReadProperties(pFile, m_readMutatePoint); // flush any leftover read bits pFile->FlushReadBits(); } void MP4Descriptor::ReadHeader(MP4File* pFile) { VERBOSE_READ(pFile->GetVerbosity(), printf("ReadDescriptor: pos = 0x"X64"\n", pFile->GetPosition())); // read tag and length u_int8_t tag = pFile->ReadUInt8(); if (m_tag) { ASSERT(tag == m_tag); } else { m_tag = tag; } m_size = pFile->ReadMpegLength(); m_start = pFile->GetPosition(); VERBOSE_READ(pFile->GetVerbosity(), printf("ReadDescriptor: tag 0x%02x data size %u (0x%x)\n", m_tag, m_size, m_size)); } void MP4Descriptor::ReadProperties(MP4File* pFile, u_int32_t propStartIndex, u_int32_t propCount) { u_int32_t numProperties = MIN(propCount, m_pProperties.Size() - propStartIndex); for (u_int32_t i = propStartIndex; i < propStartIndex + numProperties; i++) { MP4Property* pProperty = m_pProperties[i]; int32_t remaining = m_size - (pFile->GetPosition() - m_start); if (pProperty->GetType() == DescriptorProperty) { if (remaining > 0) { // place a limit on how far this sub-descriptor looks ((MP4DescriptorProperty*)pProperty)->SetSizeLimit(remaining); pProperty->Read(pFile); } // else do nothing, empty descriptor } else { // non-descriptor property if (remaining >= 0) { pProperty->Read(pFile); if (pProperty->GetType() == TableProperty) { VERBOSE_READ_TABLE(pFile->GetVerbosity(), printf("Read: "); pProperty->Dump(stdout, 0, true)); } else { VERBOSE_READ(pFile->GetVerbosity(), printf("Read: "); pProperty->Dump(stdout, 0, true)); } } else { VERBOSE_ERROR(pFile->GetVerbosity(), printf("Overran descriptor, tag %u data size %u property %u\n", m_tag, m_size, i)); throw new MP4Error("overran descriptor", "MP4Descriptor::ReadProperties"); } } } } void MP4Descriptor::Write(MP4File* pFile) { // call virtual function to adapt properties before writing Mutate(); u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } // write tag and length placeholder pFile->WriteUInt8(m_tag); u_int64_t lengthPos = pFile->GetPosition(); pFile->WriteMpegLength(0); u_int64_t startPos = pFile->GetPosition(); for (u_int32_t i = 0; i < numProperties; i++) { m_pProperties[i]->Write(pFile); } // align with byte boundary (rarely necessary) pFile->PadWriteBits(); // go back and write correct length u_int64_t endPos = pFile->GetPosition(); pFile->SetPosition(lengthPos); pFile->WriteMpegLength(endPos - startPos); pFile->SetPosition(endPos); } void MP4Descriptor::WriteToMemory(MP4File* pFile, u_int8_t** ppBytes, u_int64_t* pNumBytes) { // use memory buffer to save descriptor in memory // instead of going directly to disk pFile->EnableMemoryBuffer(); Write(pFile); pFile->DisableMemoryBuffer(ppBytes, pNumBytes); } void MP4Descriptor::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) { // call virtual function to adapt properties before dumping Mutate(); u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } for (u_int32_t i = 0; i < numProperties; i++) { m_pProperties[i]->Dump(pFile, indent, dumpImplicits); } } u_int8_t MP4Descriptor::GetDepth() { if (m_pParentAtom) { return m_pParentAtom->GetDepth(); } return 0; } faac-1.28/common/mp4v2/mp4descriptor.h0000644010307701030770000000466110101411050021242 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_DESCRIPTOR_INCLUDED__ #define __MP4_DESCRIPTOR_INCLUDED__ class MP4Descriptor { public: MP4Descriptor(u_int8_t tag = 0); virtual ~MP4Descriptor(); u_int8_t GetTag() { return m_tag; } void SetTag(u_int8_t tag) { m_tag = tag; } void SetParentAtom(MP4Atom* pParentAtom) { m_pParentAtom = pParentAtom; for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { m_pProperties[i]->SetParentAtom(pParentAtom); } } void AddProperty(MP4Property* pProperty); virtual void Generate(); virtual void Read(MP4File* pFile); virtual void Write(MP4File* pFile); virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); MP4Property* GetProperty(u_int32_t index) { return m_pProperties[index]; } // use with extreme caution void SetProperty(u_int32_t index, MP4Property* pProperty) { m_pProperties[index] = pProperty; } bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL) { return FindContainedProperty(name, ppProperty, pIndex); } void WriteToMemory(MP4File* pFile, u_int8_t** ppBytes, u_int64_t* pNumBytes); protected: void SetReadMutate(u_int32_t propIndex) { m_readMutatePoint = propIndex; } void ReadHeader(MP4File* pFile); void ReadProperties(MP4File* pFile, u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); virtual void Mutate() { // default is a no-op }; bool FindContainedProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex); u_int8_t GetDepth(); protected: MP4Atom* m_pParentAtom; u_int8_t m_tag; u_int64_t m_start; u_int32_t m_size; MP4PropertyArray m_pProperties; u_int32_t m_readMutatePoint; }; #endif /* __MP4_DESCRIPTOR_INCLUDED__ */ faac-1.28/common/mp4v2/mp4file.cpp0000644010307701030770000025634511136736372020400 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com * Bill May wmay@cisco.com */ #include "mp4common.h" MP4File::MP4File(u_int32_t verbosity) { m_fileName = NULL; #ifdef _WIN32 m_fileName_w = NULL; #endif m_pFile = NULL; m_virtual_IO = NULL; m_orgFileSize = 0; m_fileSize = 0; m_pRootAtom = NULL; m_odTrackId = MP4_INVALID_TRACK_ID; m_verbosity = verbosity; m_mode = 0; m_createFlags = 0; m_useIsma = false; m_pModificationProperty = NULL; m_pTimeScaleProperty = NULL; m_pDurationProperty = NULL; m_memoryBuffer = NULL; m_memoryBufferSize = 0; m_memoryBufferPosition = 0; m_numReadBits = 0; m_bufReadBits = 0; m_numWriteBits = 0; m_bufWriteBits = 0; m_editName = NULL; #ifndef _WIN32 m_tempFileName[0] = '\0'; #endif m_trakName[0] = '\0'; } MP4File::~MP4File() { MP4Free(m_fileName); #ifdef _WIN32 MP4Free(m_fileName_w); #endif if (m_pFile != NULL) { // not closed ? m_virtual_IO->Close(m_pFile); m_pFile = NULL; } delete m_pRootAtom; for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { delete m_pTracks[i]; } MP4Free(m_memoryBuffer); // just in case CHECK_AND_FREE(m_editName); } void MP4File::Read(const char* fileName) { m_fileName = MP4Stralloc(fileName); m_mode = 'r'; Open("rb"); ReadFromFile(); CacheProperties(); } #ifdef _WIN32 void MP4File::Read(const wchar_t* fileName) { m_fileName_w = MP4Stralloc(fileName); m_mode = 'r'; Open(L"rb"); ReadFromFile(); CacheProperties(); } #endif // benski> void MP4File::ReadEx(const char *fileName, void *user, Virtual_IO *virtual_IO) { m_fileName = MP4Stralloc(fileName); m_mode = 'r'; m_pFile = user; m_virtual_IO = virtual_IO; ASSERT(m_pFile); ASSERT(m_virtual_IO) m_orgFileSize = m_fileSize = m_virtual_IO->GetFileLength(m_pFile); ReadFromFile(); CacheProperties(); } void MP4File::Create(const char* fileName, u_int32_t flags, int add_ftyp, int add_iods, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount) { m_fileName = MP4Stralloc(fileName); m_mode = 'w'; m_createFlags = flags; Open("wb+"); // generate a skeletal atom tree m_pRootAtom = MP4Atom::CreateAtom(NULL); m_pRootAtom->SetFile(this); m_pRootAtom->Generate(); if (add_ftyp != 0) { MakeFtypAtom(majorBrand, minorVersion, supportedBrands, supportedBrandsCount); } CacheProperties(); // create mdat, and insert it after ftyp, and before moov (void)InsertChildAtom(m_pRootAtom, "mdat", add_ftyp != 0 ? 1 : 0); // start writing m_pRootAtom->BeginWrite(); if (add_iods != 0) { (void)AddChildAtom("moov", "iods"); } } bool MP4File::Use64Bits (const char *atomName) { uint32_t atomid = ATOMID(atomName); if (atomid == ATOMID("mdat") || atomid == ATOMID("stbl")) { return (m_createFlags & MP4_CREATE_64BIT_DATA) == MP4_CREATE_64BIT_DATA; } if (atomid == ATOMID("mvhd") || atomid == ATOMID("tkhd") || atomid == ATOMID("mdhd")) { return (m_createFlags & MP4_CREATE_64BIT_TIME) == MP4_CREATE_64BIT_TIME; } return false; } void MP4File::Check64BitStatus (const char *atomName) { uint32_t atomid = ATOMID(atomName); if (atomid == ATOMID("mdat") || atomid == ATOMID("stbl")) { m_createFlags |= MP4_CREATE_64BIT_DATA; } else if (atomid == ATOMID("mvhd") || atomid == ATOMID("tkhd") || atomid == ATOMID("mdhd")) { m_createFlags |= MP4_CREATE_64BIT_TIME; } } bool MP4File::Modify(const char* fileName) { m_fileName = MP4Stralloc(fileName); m_mode = 'r'; Open("rb+"); ReadFromFile(); m_mode = 'w'; // find the moov atom MP4Atom* pMoovAtom = m_pRootAtom->FindAtom("moov"); u_int32_t numAtoms; if (pMoovAtom == NULL) { // there isn't one, odd but we can still proceed return false; //pMoovAtom = AddChildAtom(m_pRootAtom, "moov"); } else { numAtoms = m_pRootAtom->GetNumberOfChildAtoms(); // work backwards thru the top level atoms int32_t i; bool lastAtomIsMoov = true; MP4Atom* pLastAtom = NULL; for (i = numAtoms - 1; i >= 0; i--) { MP4Atom* pAtom = m_pRootAtom->GetChildAtom(i); const char* type = pAtom->GetType(); // get rid of any trailing free or skips if (!strcmp(type, "free") || !strcmp(type, "skip")) { m_pRootAtom->DeleteChildAtom(pAtom); continue; } if (strcmp(type, "moov")) { if (pLastAtom == NULL) { pLastAtom = pAtom; lastAtomIsMoov = false; } continue; } // now at moov atom // multiple moov atoms?!? if (pAtom != pMoovAtom) { throw new MP4Error( "Badly formed mp4 file, multiple moov atoms", "MP4Modify"); } if (lastAtomIsMoov) { // position to start of moov atom, // effectively truncating file // prior to adding new mdat SetPosition(pMoovAtom->GetStart()); } else { // last atom isn't moov // need to place a free atom MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free"); // in existing position of the moov atom m_pRootAtom->InsertChildAtom(pFreeAtom, i); m_pRootAtom->DeleteChildAtom(pMoovAtom); m_pRootAtom->AddChildAtom(pMoovAtom); // write free atom to disk SetPosition(pMoovAtom->GetStart()); pFreeAtom->SetSize(pMoovAtom->GetSize()); pFreeAtom->Write(); // finally set our file position to the end of the last atom SetPosition(pLastAtom->GetEnd()); } break; } ASSERT(i != -1); } CacheProperties(); // of moov atom numAtoms = m_pRootAtom->GetNumberOfChildAtoms(); // insert another mdat prior to moov atom (the last atom) MP4Atom* pMdatAtom = InsertChildAtom(m_pRootAtom, "mdat", numAtoms - 1); // start writing new mdat pMdatAtom->BeginWrite(Use64Bits("mdat")); return true; } void MP4File::Optimize(const char* orgFileName, const char* newFileName) { m_fileName = MP4Stralloc(orgFileName); m_mode = 'r'; // first load meta-info into memory Open("rb"); ReadFromFile(); CacheProperties(); // of moov atom // now switch over to writing the new file MP4Free(m_fileName); #ifdef _WIN32 MP4Free(m_fileName_w); #endif // create a temporary file if necessary if (newFileName == NULL) { m_fileName = MP4Stralloc(TempFileName()); } else { m_fileName = MP4Stralloc(newFileName); } void* pReadFile = m_pFile; Virtual_IO *pReadIO = m_virtual_IO; m_pFile = NULL; m_mode = 'w'; Open("wb"); SetIntegerProperty("moov.mvhd.modificationTime", MP4GetAbsTimestamp()); // writing meta info in the optimal order ((MP4RootAtom*)m_pRootAtom)->BeginOptimalWrite(); // write data in optimal order RewriteMdat(pReadFile, m_pFile, pReadIO, m_virtual_IO); // finish writing ((MP4RootAtom*)m_pRootAtom)->FinishOptimalWrite(); // cleanup m_virtual_IO->Close(m_pFile); m_pFile = NULL; pReadIO->Close(pReadFile); // move temporary file into place if (newFileName == NULL) { Rename(m_fileName, orgFileName); } } void MP4File::RewriteMdat(void* pReadFile, void* pWriteFile, Virtual_IO *readIO, Virtual_IO *writeIO) { u_int32_t numTracks = m_pTracks.Size(); MP4ChunkId* chunkIds = new MP4ChunkId[numTracks]; MP4ChunkId* maxChunkIds = new MP4ChunkId[numTracks]; MP4Timestamp* nextChunkTimes = new MP4Timestamp[numTracks]; for (u_int32_t i = 0; i < numTracks; i++) { chunkIds[i] = 1; maxChunkIds[i] = m_pTracks[i]->GetNumberOfChunks(); nextChunkTimes[i] = MP4_INVALID_TIMESTAMP; } while (true) { u_int32_t nextTrackIndex = (u_int32_t)-1; MP4Timestamp nextTime = MP4_INVALID_TIMESTAMP; for (u_int32_t i = 0; i < numTracks; i++) { if (chunkIds[i] > maxChunkIds[i]) { continue; } if (nextChunkTimes[i] == MP4_INVALID_TIMESTAMP) { MP4Timestamp chunkTime = m_pTracks[i]->GetChunkTime(chunkIds[i]); nextChunkTimes[i] = MP4ConvertTime(chunkTime, m_pTracks[i]->GetTimeScale(), GetTimeScale()); } // time is not earliest so far if (nextChunkTimes[i] > nextTime) { continue; } // prefer hint tracks to media tracks if times are equal if (nextChunkTimes[i] == nextTime && strcmp(m_pTracks[i]->GetType(), MP4_HINT_TRACK_TYPE)) { continue; } // this is our current choice of tracks nextTime = nextChunkTimes[i]; nextTrackIndex = i; } if (nextTrackIndex == (u_int32_t)-1) { break; } // point into original mp4 file for read chunk call m_pFile = pReadFile; m_virtual_IO = readIO; m_mode = 'r'; u_int8_t* pChunk; u_int32_t chunkSize; m_pTracks[nextTrackIndex]-> ReadChunk(chunkIds[nextTrackIndex], &pChunk, &chunkSize); // point back at the new mp4 file for write chunk m_pFile = pWriteFile; m_virtual_IO = writeIO; m_mode = 'w'; m_pTracks[nextTrackIndex]-> RewriteChunk(chunkIds[nextTrackIndex], pChunk, chunkSize); MP4Free(pChunk); chunkIds[nextTrackIndex]++; nextChunkTimes[nextTrackIndex] = MP4_INVALID_TIMESTAMP; } delete [] chunkIds; delete [] maxChunkIds; delete [] nextChunkTimes; } void MP4File::Open(const char* fmode) { ASSERT(m_pFile == NULL); FILE *openFile = NULL; #ifdef O_LARGEFILE // UGH! fopen doesn't open a file in 64-bit mode, period. // So we need to use open() and then fdopen() int fd; int flags = O_LARGEFILE; if (strchr(fmode, '+')) { flags |= O_CREAT | O_RDWR; if (fmode[0] == 'w') { flags |= O_TRUNC; } } else { if (fmode[0] == 'w') { flags |= O_CREAT | O_TRUNC | O_WRONLY; } else { flags |= O_RDONLY; } } fd = open(m_fileName, flags, 0666); if (fd >= 0) { openFile = fdopen(fd, fmode); } #else openFile = fopen(m_fileName, fmode); #endif m_pFile = openFile; if (m_pFile == NULL) { throw new MP4Error(errno, "failed", "MP4Open"); } m_virtual_IO = &FILE_virtual_IO; if (m_mode == 'r') { m_orgFileSize = m_fileSize = m_virtual_IO->GetFileLength(m_pFile); // benski } else { m_orgFileSize = m_fileSize = 0; } } #ifdef _WIN32 void MP4File::Open(const wchar_t* fmode) { ASSERT(m_pFile == NULL); FILE *openFile = NULL; #ifdef O_LARGEFILE // UGH! fopen doesn't open a file in 64-bit mode, period. // So we need to use open() and then fdopen() int fd; int flags = O_LARGEFILE; if (strchr(fmode, '+')) { flags |= O_CREAT | O_RDWR; if (fmode[0] == 'w') { flags |= O_TRUNC; } } else { if (fmode[0] == 'w') { flags |= O_CREAT | O_TRUNC | O_WRONLY; } else { flags |= O_RDONLY; } } fd = _wopen(m_fileName_w, flags, 0666); if (fd >= 0) { openFile = _wfdopen(fd, fmode); } #else openFile = _wfopen(m_fileName_w, fmode); #endif m_pFile = openFile; if (m_pFile == NULL) { throw new MP4Error(errno, "failed", "MP4Open"); } m_virtual_IO = &FILE_virtual_IO; if (m_mode == 'r') { m_orgFileSize = m_fileSize = m_virtual_IO->GetFileLength(m_pFile); // benski } else { m_orgFileSize = m_fileSize = 0; } } #endif void MP4File::ReadFromFile() { // ensure we start at beginning of file SetPosition(0); // create a new root atom ASSERT(m_pRootAtom == NULL); m_pRootAtom = MP4Atom::CreateAtom(NULL); u_int64_t fileSize = GetSize(); m_pRootAtom->SetFile(this); m_pRootAtom->SetStart(0); m_pRootAtom->SetSize(fileSize); m_pRootAtom->SetEnd(fileSize); m_pRootAtom->Read(); // create MP4Track's for any tracks in the file GenerateTracks(); } void MP4File::GenerateTracks() { u_int32_t trackIndex = 0; while (true) { char trackName[32]; snprintf(trackName, sizeof(trackName), "moov.trak[%u]", trackIndex); // find next trak atom MP4Atom* pTrakAtom = m_pRootAtom->FindAtom(trackName); // done, no more trak atoms if (pTrakAtom == NULL) { break; } // find track id property MP4Integer32Property* pTrackIdProperty = NULL; (void)pTrakAtom->FindProperty( "trak.tkhd.trackId", (MP4Property**)&pTrackIdProperty); // find track type property MP4StringProperty* pTypeProperty = NULL; (void)pTrakAtom->FindProperty( "trak.mdia.hdlr.handlerType", (MP4Property**)&pTypeProperty); // ensure we have the basics properties if (pTrackIdProperty && pTypeProperty) { m_trakIds.Add(pTrackIdProperty->GetValue()); MP4Track* pTrack = NULL; try { if (!strcmp(pTypeProperty->GetValue(), MP4_HINT_TRACK_TYPE)) { pTrack = new MP4RtpHintTrack(this, pTrakAtom); } else { pTrack = new MP4Track(this, pTrakAtom); } m_pTracks.Add(pTrack); } catch (MP4Error* e) { VERBOSE_ERROR(m_verbosity, e->Print()); delete e; } // remember when we encounter the OD track if (pTrack && !strcmp(pTrack->GetType(), MP4_OD_TRACK_TYPE)) { if (m_odTrackId == MP4_INVALID_TRACK_ID) { m_odTrackId = pTrackIdProperty->GetValue(); } else { VERBOSE_READ(GetVerbosity(), printf("Warning: multiple OD tracks present\n")); } } } else { m_trakIds.Add(0); } trackIndex++; } } void MP4File::CacheProperties() { FindIntegerProperty("moov.mvhd.modificationTime", (MP4Property**)&m_pModificationProperty); FindIntegerProperty("moov.mvhd.timeScale", (MP4Property**)&m_pTimeScaleProperty); FindIntegerProperty("moov.mvhd.duration", (MP4Property**)&m_pDurationProperty); } void MP4File::BeginWrite() { m_pRootAtom->BeginWrite(); } void MP4File::FinishWrite() { // for all tracks, flush chunking buffers for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { ASSERT(m_pTracks[i]); m_pTracks[i]->FinishWrite(); } // ask root atom to write m_pRootAtom->FinishWrite(); // check if file shrunk, e.g. we deleted a track if (GetSize() < m_orgFileSize) { // just use a free atom to mark unused space // MP4Optimize() should be used to clean up this space MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free"); ASSERT(pFreeAtom); pFreeAtom->SetFile(this); int64_t size = m_orgFileSize - (m_fileSize + 8); if (size < 0) size = 0; pFreeAtom->SetSize(size); pFreeAtom->Write(); delete pFreeAtom; } } void MP4File::UpdateDuration(MP4Duration duration) { MP4Duration currentDuration = GetDuration(); if (duration > currentDuration) { SetDuration(duration); } } void MP4File::Dump(FILE* pDumpFile, bool dumpImplicits) { if (pDumpFile == NULL) { pDumpFile = stdout; } fprintf(pDumpFile, "Dumping %s meta-information...\n", m_fileName); m_pRootAtom->Dump(pDumpFile, 0, dumpImplicits); } void MP4File::Close() { if (m_mode == 'w') { SetIntegerProperty("moov.mvhd.modificationTime", MP4GetAbsTimestamp()); FinishWrite(); } m_virtual_IO->Close(m_pFile); m_pFile = NULL; } const char* MP4File::TempFileName() { // there are so many attempts in libc to get this right // that for portablity reasons, it's best just to roll our own #ifndef _WIN32 u_int32_t i; for (i = getpid(); i < 0xFFFFFFFF; i++) { snprintf(m_tempFileName, sizeof(m_tempFileName), "./tmp%u.mp4", i); if (access(m_tempFileName, F_OK) != 0) { break; } } if (i == 0xFFFFFFFF) { throw new MP4Error("can't create temporary file", "TempFileName"); } #else GetTempFileNameA(".", // dir. for temp. files "mp4", // temp. filename prefix 0, // create unique name m_tempFileName); // buffer for name #endif return (char *)m_tempFileName; } void MP4File::Rename(const char* oldFileName, const char* newFileName) { int rc; #ifdef _WIN32 rc = remove(newFileName); if (rc == 0) { rc = rename(oldFileName, newFileName); } #else rc = rename(oldFileName, newFileName); #endif if (rc != 0) { throw new MP4Error(errno, "can't overwrite existing file", "Rename"); } } void MP4File::ProtectWriteOperation(char* where) { if (m_mode == 'r') { throw new MP4Error("operation not permitted in read mode", where); } } MP4Track* MP4File::GetTrack(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]; } MP4Atom* MP4File::FindAtom(const char* name) { MP4Atom* pAtom = NULL; if (!name || !strcmp(name, "")) { pAtom = m_pRootAtom; } else { pAtom = m_pRootAtom->FindAtom(name); } return pAtom; } MP4Atom* MP4File::AddChildAtom( const char* parentName, const char* childName) { return AddChildAtom(FindAtom(parentName), childName); } MP4Atom* MP4File::AddChildAtom( MP4Atom* pParentAtom, const char* childName) { return InsertChildAtom(pParentAtom, childName, pParentAtom->GetNumberOfChildAtoms()); } MP4Atom* MP4File::InsertChildAtom( const char* parentName, const char* childName, u_int32_t index) { return InsertChildAtom(FindAtom(parentName), childName, index); } MP4Atom* MP4File::InsertChildAtom( MP4Atom* pParentAtom, const char* childName, u_int32_t index) { MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName); ASSERT(pParentAtom); pParentAtom->InsertChildAtom(pChildAtom, index); pChildAtom->Generate(); return pChildAtom; } MP4Atom* MP4File::AddDescendantAtoms( const char* ancestorName, const char* descendantNames) { return AddDescendantAtoms(FindAtom(ancestorName), descendantNames); } MP4Atom* MP4File::AddDescendantAtoms( MP4Atom* pAncestorAtom, const char* descendantNames) { ASSERT(pAncestorAtom); MP4Atom* pParentAtom = pAncestorAtom; MP4Atom* pChildAtom = NULL; while (true) { char* childName = MP4NameFirst(descendantNames); if (childName == NULL) { break; } descendantNames = MP4NameAfterFirst(descendantNames); pChildAtom = pParentAtom->FindChildAtom(childName); if (pChildAtom == NULL) { pChildAtom = AddChildAtom(pParentAtom, childName); } pParentAtom = pChildAtom; MP4Free(childName); } return pChildAtom; } bool MP4File::FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (pIndex) { *pIndex = 0; // set the default answer for index } return m_pRootAtom->FindProperty(name, ppProperty, pIndex); } void MP4File::FindIntegerProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property - %s", "MP4File::FindIntegerProperty", name); } switch ((*ppProperty)->GetType()) { case Integer8Property: case Integer16Property: case Integer24Property: case Integer32Property: case Integer64Property: break; default: throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindIntegerProperty", name, (*ppProperty)->GetType()); } } u_int64_t MP4File::GetIntegerProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindIntegerProperty(name, &pProperty, &index); return ((MP4IntegerProperty*)pProperty)->GetValue(index); } void MP4File::SetIntegerProperty(const char* name, u_int64_t value) { ProtectWriteOperation("SetIntegerProperty"); MP4Property* pProperty = NULL; u_int32_t index = 0; FindIntegerProperty(name, &pProperty, &index); ((MP4IntegerProperty*)pProperty)->SetValue(value, index); } void MP4File::FindFloatProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property - %s", "MP4File::FindFloatProperty", name); } if ((*ppProperty)->GetType() != Float32Property) { throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindFloatProperty", name, (*ppProperty)->GetType()); } } float MP4File::GetFloatProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindFloatProperty(name, &pProperty, &index); return ((MP4Float32Property*)pProperty)->GetValue(index); } void MP4File::SetFloatProperty(const char* name, float value) { ProtectWriteOperation("SetFloatProperty"); MP4Property* pProperty; u_int32_t index; FindFloatProperty(name, &pProperty, &index); ((MP4Float32Property*)pProperty)->SetValue(value, index); } void MP4File::FindStringProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property - %s", "MP4File::FindStringProperty", name); } if ((*ppProperty)->GetType() != StringProperty) { throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindStringProperty", name, (*ppProperty)->GetType()); } } const char* MP4File::GetStringProperty(const char* name) { MP4Property* pProperty; u_int32_t index; FindStringProperty(name, &pProperty, &index); return ((MP4StringProperty*)pProperty)->GetValue(index); } void MP4File::SetStringProperty(const char* name, const char* value) { ProtectWriteOperation("SetStringProperty"); MP4Property* pProperty; u_int32_t index; FindStringProperty(name, &pProperty, &index); ((MP4StringProperty*)pProperty)->SetValue(value, index); } void MP4File::FindBytesProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (!FindProperty(name, ppProperty, pIndex)) { throw new MP4Error("no such property %s", "MP4File::FindBytesProperty", name); } if ((*ppProperty)->GetType() != BytesProperty) { throw new MP4Error("type mismatch - property %s - type %d", "MP4File::FindBytesProperty", name, (*ppProperty)->GetType()); } } void MP4File::GetBytesProperty(const char* name, u_int8_t** ppValue, u_int32_t* pValueSize) { MP4Property* pProperty; u_int32_t index; FindBytesProperty(name, &pProperty, &index); ((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index); } void MP4File::SetBytesProperty(const char* name, const u_int8_t* pValue, u_int32_t valueSize) { ProtectWriteOperation("SetBytesProperty"); MP4Property* pProperty; u_int32_t index; FindBytesProperty(name, &pProperty, &index); ((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index); } // track functions MP4TrackId MP4File::AddTrack(const char* type, u_int32_t timeScale) { ProtectWriteOperation("AddTrack"); // create and add new trak atom MP4Atom* pTrakAtom = AddChildAtom("moov", "trak"); // allocate a new track id MP4TrackId trackId = AllocTrackId(); m_trakIds.Add(trackId); // set track id MP4Integer32Property* pInteger32Property = NULL; (void)pTrakAtom->FindProperty("trak.tkhd.trackId", (MP4Property**)&pInteger32Property); ASSERT(pInteger32Property); pInteger32Property->SetValue(trackId); // set track type const char* normType = MP4NormalizeTrackType(type, m_verbosity); // sanity check for user defined types if (strlen(normType) > 4) { VERBOSE_WARNING(m_verbosity, printf("AddTrack: type truncated to four characters\n")); // StringProperty::SetValue() will do the actual truncation } MP4StringProperty* pStringProperty = NULL; (void)pTrakAtom->FindProperty("trak.mdia.hdlr.handlerType", (MP4Property**)&pStringProperty); ASSERT(pStringProperty); pStringProperty->SetValue(normType); // set track time scale pInteger32Property = NULL; (void)pTrakAtom->FindProperty("trak.mdia.mdhd.timeScale", (MP4Property**)&pInteger32Property); ASSERT(pInteger32Property); pInteger32Property->SetValue(timeScale ? timeScale : 1000); // now have enough to create MP4Track object MP4Track* pTrack = NULL; if (!strcmp(normType, MP4_HINT_TRACK_TYPE)) { pTrack = new MP4RtpHintTrack(this, pTrakAtom); } else { pTrack = new MP4Track(this, pTrakAtom); } m_pTracks.Add(pTrack); // mark non-hint tracks as enabled if (strcmp(normType, MP4_HINT_TRACK_TYPE)) { SetTrackIntegerProperty(trackId, "tkhd.flags", 1); } // mark track as contained in this file // LATER will provide option for external data references AddDataReference(trackId, NULL); return trackId; } void MP4File::AddTrackToIod(MP4TrackId trackId) { MP4DescriptorProperty* pDescriptorProperty = NULL; (void)m_pRootAtom->FindProperty("moov.iods.esIds", (MP4Property**)&pDescriptorProperty); ASSERT(pDescriptorProperty); MP4Descriptor* pDescriptor = pDescriptorProperty->AddDescriptor(MP4ESIDIncDescrTag); ASSERT(pDescriptor); MP4Integer32Property* pIdProperty = NULL; (void)pDescriptor->FindProperty("id", (MP4Property**)&pIdProperty); ASSERT(pIdProperty); pIdProperty->SetValue(trackId); } void MP4File::RemoveTrackFromIod(MP4TrackId trackId, bool shallHaveIods) { MP4DescriptorProperty* pDescriptorProperty = NULL; if (!m_pRootAtom->FindProperty("moov.iods.esIds", (MP4Property**)&pDescriptorProperty)) return; #if 0 // we may not have iods if (shallHaveIods) { ASSERT(pDescriptorProperty); } else { if (!pDescriptorProperty) { return; } } #else if (pDescriptorProperty == NULL) { return; } #endif for (u_int32_t i = 0; i < pDescriptorProperty->GetCount(); i++) { /* static */char name[32]; snprintf(name, sizeof(name), "esIds[%u].id", i); MP4Integer32Property* pIdProperty = NULL; (void)pDescriptorProperty->FindProperty(name, (MP4Property**)&pIdProperty); // wmay ASSERT(pIdProperty); if (pIdProperty != NULL && pIdProperty->GetValue() == trackId) { pDescriptorProperty->DeleteDescriptor(i); break; } } } void MP4File::AddTrackToOd(MP4TrackId trackId) { if (!m_odTrackId) { return; } AddTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId); } void MP4File::RemoveTrackFromOd(MP4TrackId trackId) { if (!m_odTrackId) { return; } RemoveTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId); } void MP4File::GetTrackReferenceProperties(const char* trefName, MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty) { char propName[1024]; snprintf(propName, sizeof(propName), "%s.%s", trefName, "entryCount"); (void)m_pRootAtom->FindProperty(propName, ppCountProperty); ASSERT(*ppCountProperty); snprintf(propName, sizeof(propName), "%s.%s", trefName, "entries.trackId"); (void)m_pRootAtom->FindProperty(propName, ppTrackIdProperty); ASSERT(*ppTrackIdProperty); } void MP4File::AddTrackReference(const char* trefName, MP4TrackId refTrackId) { MP4Integer32Property* pCountProperty = NULL; MP4Integer32Property* pTrackIdProperty = NULL; GetTrackReferenceProperties(trefName, (MP4Property**)&pCountProperty, (MP4Property**)&pTrackIdProperty); pTrackIdProperty->AddValue(refTrackId); pCountProperty->IncrementValue(); } u_int32_t MP4File::FindTrackReference(const char* trefName, MP4TrackId refTrackId) { MP4Integer32Property* pCountProperty = NULL; MP4Integer32Property* pTrackIdProperty = NULL; GetTrackReferenceProperties(trefName, (MP4Property**)&pCountProperty, (MP4Property**)&pTrackIdProperty); for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) { if (refTrackId == pTrackIdProperty->GetValue(i)) { return i + 1; // N.B. 1 not 0 based index } } return 0; } void MP4File::RemoveTrackReference(const char* trefName, MP4TrackId refTrackId) { MP4Integer32Property* pCountProperty = NULL; MP4Integer32Property* pTrackIdProperty = NULL; GetTrackReferenceProperties(trefName, (MP4Property**)&pCountProperty, (MP4Property**)&pTrackIdProperty); for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) { if (refTrackId == pTrackIdProperty->GetValue(i)) { pTrackIdProperty->DeleteValue(i); pCountProperty->IncrementValue(-1); } } } void MP4File::AddDataReference(MP4TrackId trackId, const char* url) { MP4Atom* pDrefAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.dinf.dref")); ASSERT(pDrefAtom); MP4Integer32Property* pCountProperty = NULL; (void)pDrefAtom->FindProperty("dref.entryCount", (MP4Property**)&pCountProperty); ASSERT(pCountProperty); pCountProperty->IncrementValue(); MP4Atom* pUrlAtom = AddChildAtom(pDrefAtom, "url "); if (url && url[0] != '\0') { pUrlAtom->SetFlags(pUrlAtom->GetFlags() & 0xFFFFFE); MP4StringProperty* pUrlProperty = NULL; (void)pUrlAtom->FindProperty("url .location", (MP4Property**)&pUrlProperty); ASSERT(pUrlProperty); pUrlProperty->SetValue(url); } else { pUrlAtom->SetFlags(pUrlAtom->GetFlags() | 1); } } MP4TrackId MP4File::AddSystemsTrack(const char* type) { const char* normType = MP4NormalizeTrackType(type, m_verbosity); // TBD if user type, fix name to four chars, and warn MP4TrackId trackId = AddTrack(type, MP4_MSECS_TIME_SCALE); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4s"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the mp4s atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4s.esds.ESID", #if 0 // note - for a file, these values need to // be 0 - wmay - 04/16/2003 trackId #else 0 #endif ); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", MP4SystemsV1ObjectType); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.streamType", ConvertTrackTypeToStreamType(normType)); return trackId; } MP4TrackId MP4File::AddODTrack() { // until a demonstrated need emerges // we limit ourselves to one object description track if (m_odTrackId != MP4_INVALID_TRACK_ID) { throw new MP4Error("object description track already exists", "AddObjectDescriptionTrack"); } m_odTrackId = AddSystemsTrack(MP4_OD_TRACK_TYPE); AddTrackToIod(m_odTrackId); (void)AddDescendantAtoms(MakeTrackName(m_odTrackId, NULL), "tref.mpod"); return m_odTrackId; } MP4TrackId MP4File::AddSceneTrack() { MP4TrackId trackId = AddSystemsTrack(MP4_SCENE_TRACK_TYPE); AddTrackToIod(trackId); AddTrackToOd(trackId); return trackId; } // NULL terminated list of brands which require the IODS atom char *brandsWithIods[] = { "mp42", "isom", NULL}; bool MP4File::ShallHaveIods() { u_int32_t compatibleBrandsCount; MP4StringProperty *pMajorBrandProperty; MP4Atom* ftypAtom = m_pRootAtom->FindAtom("ftyp"); if (ftypAtom == NULL) return false; // Check the major brand (void)ftypAtom->FindProperty( "ftyp.majorBrand", (MP4Property**)&pMajorBrandProperty); ASSERT(pMajorBrandProperty); for(u_int32_t j = 0 ; brandsWithIods[j] != NULL ; j++) { if (!strcasecmp( ((MP4StringProperty*)pMajorBrandProperty)->GetValue(), brandsWithIods[j])) return true; } // Check the compatible brands MP4Integer32Property* pCompatibleBrandsCountProperty; (void)ftypAtom->FindProperty( "ftyp.compatibleBrandsCount", (MP4Property**)&pCompatibleBrandsCountProperty); ASSERT(pCompatibleBrandsCountProperty); compatibleBrandsCount = pCompatibleBrandsCountProperty->GetValue(); MP4TableProperty* pCompatibleBrandsProperty; (void)ftypAtom->FindProperty( "ftyp.compatibleBrands", (MP4Property**)&pCompatibleBrandsProperty); MP4StringProperty* pBrandProperty = (MP4StringProperty*)pCompatibleBrandsProperty->GetProperty(0); ASSERT(pBrandProperty); for(u_int32_t i = 0 ; i < compatibleBrandsCount ; i++) { for(u_int32_t j = 0 ; brandsWithIods[j] != NULL ; j++) { if (!strcasecmp(pBrandProperty->GetValue(i), brandsWithIods[j])) return true; } } return false; } void MP4File::SetAmrVendor( MP4TrackId trackId, u_int32_t vendor) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.vendor", vendor); } void MP4File::SetAmrDecoderVersion( MP4TrackId trackId, u_int8_t decoderVersion) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.decoderVersion", decoderVersion); } void MP4File::SetAmrModeSet( MP4TrackId trackId, u_int16_t modeSet) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.modeSet", modeSet); } uint16_t MP4File::GetAmrModeSet(MP4TrackId trackId) { return GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.modeSet"); } MP4TrackId MP4File::AddAmrAudioTrack( u_int32_t timeScale, u_int16_t modeSet, u_int8_t modeChangePeriod, u_int8_t framesPerSample, bool isAmrWB) { u_int32_t fixedSampleDuration = (timeScale * 20)/1000; // 20mSec/Sample MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale); AddTrackToOd(trackId); SetTrackFloatProperty(trackId, "tkhd.volume", 1.0); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), isAmrWB ? "sawb" : "samr"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the mp4a atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.timeScale", timeScale); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.modeSet", modeSet); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.modeChangePeriod", modeChangePeriod); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.damr.framesPerSample", framesPerSample); m_pTracks[FindTrackIndex(trackId)]-> SetFixedSampleDuration(fixedSampleDuration); return trackId; } MP4TrackId MP4File::AddAudioTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType) { MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale); AddTrackToOd(trackId); SetTrackFloatProperty(trackId, "tkhd.volume", 1.0); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4a"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the mp4a atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4a.timeScale", timeScale); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4a.esds.ESID", #if 0 // note - for a file, these values need to // be 0 - wmay - 04/16/2003 trackId #else 0 #endif ); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.objectTypeId", audioType); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.streamType", MP4AudioStreamType); m_pTracks[FindTrackIndex(trackId)]-> SetFixedSampleDuration(sampleDuration); return trackId; } MP4TrackId MP4File::AddEncAudioTrack(u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType, u_int32_t scheme_type, u_int16_t scheme_version, u_int8_t key_ind_len, u_int8_t iv_len, bool selective_enc, const char *kms_uri, bool use_ismacryp ) { u_int32_t original_fmt = 0; MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale); AddTrackToOd(trackId); SetTrackFloatProperty(trackId, "tkhd.volume", 1.0); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "enca"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the enca atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty(MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); /* set all the ismacryp-specific values */ // original format is mp4a if (use_ismacryp) { original_fmt = ATOMID("mp4a"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.frma.data-format", original_fmt); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.enca.sinf"), "schm"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.enca.sinf"), "schi"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi"), "iKMS"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi"), "iSFM"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schm.scheme_type", scheme_type); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schm.scheme_version", scheme_version); SetTrackStringProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi.iKMS.kms_URI", kms_uri); #if 0 if (kms_uri != NULL) { free((void *)kms_uri); } #endif SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi.iSFM.selective-encryption", selective_enc); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi.iSFM.key-indicator-length", key_ind_len); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.sinf.schi.iSFM.IV-length", iv_len); /* end ismacryp */ } SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.timeScale", timeScale); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.esds.ESID", #if 0 // note - for a file, these values need to // be 0 - wmay - 04/16/2003 trackId #else 0 #endif ); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.esds.decConfigDescr.objectTypeId", audioType); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.enca.esds.decConfigDescr.streamType", MP4AudioStreamType); m_pTracks[FindTrackIndex(trackId)]-> SetFixedSampleDuration(sampleDuration); return trackId; } MP4TrackId MP4File::AddCntlTrackDefault (uint32_t timeScale, MP4Duration sampleDuration, const char *type) { MP4TrackId trackId = AddTrack(MP4_CNTL_TRACK_TYPE, timeScale); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), type); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the mp4v atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsz.sampleSize", sampleDuration); m_pTracks[FindTrackIndex(trackId)]-> SetFixedSampleDuration(sampleDuration); return trackId; } MP4TrackId MP4File::AddHrefTrack (uint32_t timeScale, MP4Duration sampleDuration, const char *base_url) { MP4TrackId trackId = AddCntlTrackDefault(timeScale, sampleDuration, "href"); if (base_url != NULL) { (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.href"), "burl"); SetTrackStringProperty(trackId, "mdia.minf.stbl.stsd.href.burl.base_url", base_url); } return trackId; } MP4TrackId MP4File::AddVideoTrackDefault( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, const char *videoType) { MP4TrackId trackId = AddTrack(MP4_VIDEO_TRACK_TYPE, timeScale); AddTrackToOd(trackId); SetTrackFloatProperty(trackId, "tkhd.width", width); SetTrackFloatProperty(trackId, "tkhd.height", height); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "vmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), videoType); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the mp4v atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsz.sampleSize", sampleDuration); m_pTracks[FindTrackIndex(trackId)]-> SetFixedSampleDuration(sampleDuration); return trackId; } MP4TrackId MP4File::AddMP4VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType) { MP4TrackId trackId = AddVideoTrackDefault(timeScale, sampleDuration, width, height, "mp4v"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.width", width); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.height", height); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.esds.ESID", #if 0 // note - for a file, these values need to // be 0 - wmay - 04/16/2003 trackId #else 0 #endif ); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.objectTypeId", videoType); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.streamType", MP4VisualStreamType); return trackId; } // ismacrypted MP4TrackId MP4File::AddEncVideoTrack(u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType, mp4v2_ismacrypParams *icPp, const char *oFormat ) { u_int32_t original_fmt = 0; MP4TrackId trackId = AddVideoTrackDefault(timeScale, sampleDuration, width, height, "encv"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.width", width); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.height", height); /* set all the ismacryp-specific values */ original_fmt = ATOMID(oFormat); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.frma.data-format", original_fmt); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf"), "schm"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf"), "schi"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi"), "iKMS"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi"), "iSFM"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schm.scheme_type", icPp->scheme_type); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schm.scheme_version", icPp->scheme_version); SetTrackStringProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iKMS.kms_URI", icPp->kms_uri); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.selective-encryption", icPp->selective_enc); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.key-indicator-length", icPp->key_ind_len); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.IV-length", icPp->iv_len); #if 0 if (icPp->kms_uri != NULL) { free(icPp->kms_uri); } #endif SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.esds.ESID", #if 0 // note - for a file, these values need to // be 0 - wmay - 04/16/2003 trackId #else 0 #endif ); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.esds.decConfigDescr.objectTypeId", videoType); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.esds.decConfigDescr.streamType", MP4VisualStreamType); return trackId; } MP4TrackId MP4File::AddH264VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, uint8_t AVCProfileIndication, uint8_t profile_compat, uint8_t AVCLevelIndication, uint8_t sampleLenFieldSizeMinusOne) { MP4TrackId trackId = AddVideoTrackDefault(timeScale, sampleDuration, width, height, "avc1"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.width", width); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.height", height); //FIXME - check this // shouldn't need this #if 0 AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1"), "avcC"); #endif SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.avcC.AVCProfileIndication", AVCProfileIndication); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.avcC.profile_compatibility", profile_compat); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.avcC.AVCLevelIndication", AVCLevelIndication); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.avcC.lengthSizeMinusOne", sampleLenFieldSizeMinusOne); return trackId; } MP4TrackId MP4File::AddEncH264VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, MP4Atom *srcAtom, mp4v2_ismacrypParams *icPp) { u_int32_t original_fmt = 0; MP4Atom *avcCAtom; MP4TrackId trackId = AddVideoTrackDefault(timeScale, sampleDuration, width, height, "encv"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.width", width); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.height", height); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv"), "avcC"); // create default values avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.avcC")); // export source atom ((MP4AvcCAtom *) srcAtom)->Clone((MP4AvcCAtom *)avcCAtom); /* set all the ismacryp-specific values */ (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf"), "schm"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf"), "schi"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi"), "iKMS"); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi"), "iSFM"); // per ismacrypt E&A V1.1 section 9.1.2.1 'avc1' is renamed '264b' // avc1 must not appear as a sample entry name or original format name original_fmt = ATOMID("264b"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.frma.data-format", original_fmt); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schm.scheme_type", icPp->scheme_type); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schm.scheme_version", icPp->scheme_version); SetTrackStringProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iKMS.kms_URI", icPp->kms_uri); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.selective-encryption", icPp->selective_enc); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.key-indicator-length", icPp->key_ind_len); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.encv.sinf.schi.iSFM.IV-length", icPp->iv_len); return trackId; } void MP4File::AddH264SequenceParameterSet (MP4TrackId trackId, const uint8_t *pSequence, uint16_t sequenceLen) { const char *format; MP4Atom *avcCAtom; // get 4cc media format - can be avc1 or encv for ismacrypted track format = GetTrackMediaDataName(trackId); if (!strcasecmp(format, "avc1")) avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1.avcC")); else if (!strcasecmp(format, "encv")) avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.avcC")); else // huh? unknown track format return; MP4BitfieldProperty *pCount; MP4Integer16Property *pLength; MP4BytesProperty *pUnit; if ((avcCAtom->FindProperty("avcC.numOfSequenceParameterSets", (MP4Property **)&pCount) == false) || (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetLength", (MP4Property **)&pLength) == false) || (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetNALUnit", (MP4Property **)&pUnit) == false)) { VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties")); return; } uint32_t count = pCount->GetValue(); if (count > 0) { // see if we already exist for (uint32_t index = 0; index < count; index++) { if (pLength->GetValue(index) == sequenceLen) { uint8_t *seq; uint32_t seqlen; pUnit->GetValue(&seq, &seqlen, index); if (memcmp(seq, pSequence, sequenceLen) == 0) { free(seq); return; } free(seq); } } } pLength->AddValue(sequenceLen); pUnit->AddValue(pSequence, sequenceLen); pCount->IncrementValue(); return; } void MP4File::AddH264PictureParameterSet (MP4TrackId trackId, const uint8_t *pPict, uint16_t pictLen) { MP4Atom *avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1.avcC")); MP4Integer8Property *pCount; MP4Integer16Property *pLength; MP4BytesProperty *pUnit; if ((avcCAtom->FindProperty("avcC.numOfPictureParameterSets", (MP4Property **)&pCount) == false) || (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetLength", (MP4Property **)&pLength) == false) || (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetNALUnit", (MP4Property **)&pUnit) == false)) { VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC picture table properties")); return; } uint32_t count = pCount->GetValue(); if (count > 0) { // see if we already exist for (uint32_t index = 0; index < count; index++) { if (pLength->GetValue(index) == pictLen) { uint8_t *seq; uint32_t seqlen; pUnit->GetValue(&seq, &seqlen, index); if (memcmp(seq, pPict, pictLen) == 0) { VERBOSE_WRITE(m_verbosity, fprintf(stderr, "picture matches %d\n", index)); free(seq); return; } free(seq); } } } pLength->AddValue(pictLen); pUnit->AddValue(pPict, pictLen); pCount->IncrementValue(); VERBOSE_WRITE(m_verbosity, fprintf(stderr, "new picture added %d\n", pCount->GetValue())); return; } void MP4File::SetH263Vendor( MP4TrackId trackId, u_int32_t vendor) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.vendor", vendor); } void MP4File::SetH263DecoderVersion( MP4TrackId trackId, u_int8_t decoderVersion) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.decoderVersion", decoderVersion); } void MP4File::SetH263Bitrates( MP4TrackId trackId, u_int32_t avgBitrate, u_int32_t maxBitrate) { SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.bitr.avgBitrate", avgBitrate); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.bitr.maxBitrate", maxBitrate); } MP4TrackId MP4File::AddH263VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t h263Level, u_int8_t h263Profile, u_int32_t avgBitrate, u_int32_t maxBitrate) { MP4TrackId trackId = AddVideoTrackDefault(timeScale, sampleDuration, width, height, "s263"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.width", width); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.height", height); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.h263Level", h263Level); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.h263Profile", h263Profile); // Add the bitr atom (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.s263.d263"), "bitr"); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.bitr.avgBitrate", avgBitrate); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.s263.d263.bitr.maxBitrate", maxBitrate); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsz.sampleSize", sampleDuration); return trackId; } MP4TrackId MP4File::AddHintTrack(MP4TrackId refTrackId) { // validate reference track id (void)FindTrackIndex(refTrackId); MP4TrackId trackId = AddTrack(MP4_HINT_TRACK_TYPE, GetTrackTimeScale(refTrackId)); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "hmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "rtp "); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the rtp atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.rtp .tims.timeScale", GetTrackTimeScale(trackId)); (void)AddDescendantAtoms(MakeTrackName(trackId, NULL), "tref.hint"); AddTrackReference(MakeTrackName(trackId, "tref.hint"), refTrackId); (void)AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hnti.sdp "); (void)AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hinf"); return trackId; } MP4TrackId MP4File::AddTextTrack(MP4TrackId refTrackId) { // validate reference track id (void)FindTrackIndex(refTrackId); MP4TrackId trackId = AddTrack(MP4_TEXT_TRACK_TYPE, GetTrackTimeScale(refTrackId)); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "gmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "text"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the text atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); return trackId; } MP4TrackId MP4File::AddChapterTextTrack(MP4TrackId refTrackId) { // validate reference track id (void)FindTrackIndex(refTrackId); MP4TrackId trackId = AddTrack(MP4_TEXT_TRACK_TYPE, GetTrackTimeScale(refTrackId)); (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "gmhd", 0); (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "text"); // stsd is a unique beast in that it has a count of the number // of child atoms that needs to be incremented after we add the text atom MP4Integer32Property* pStsdCountProperty; FindIntegerProperty( MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), (MP4Property**)&pStsdCountProperty); pStsdCountProperty->IncrementValue(); // add a "text" atom to the generic media header // this is different to the stsd "text" atom added above // truth be told, it's not clear what this second "text" atom does, // but all iTunes Store movies (with chapter markers) have it, // as do all movies with chapter tracks made by hand in QuickTime Pro (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.gmhd"), "text"); // disable the chapter text track // it won't display anyway, as it has zero display size, // but nonetheless it's good to disable it // the track still operates as a chapter track when disabled MP4Atom *pTkhdAtom = FindAtom(MakeTrackName(trackId, "tkhd")); if (pTkhdAtom) { pTkhdAtom->SetFlags(0xE); } // add a "chapter" track reference to our reference track, // pointing to this new chapter track (void)AddDescendantAtoms(MakeTrackName(refTrackId, NULL), "tref.chap"); AddTrackReference(MakeTrackName(refTrackId, "tref.chap"), trackId); return trackId; } void MP4File::DeleteTrack(MP4TrackId trackId) { ProtectWriteOperation("MP4DeleteTrack"); u_int32_t trakIndex = FindTrakAtomIndex(trackId); u_int16_t trackIndex = FindTrackIndex(trackId); MP4Track* pTrack = m_pTracks[trackIndex]; MP4Atom* pTrakAtom = pTrack->GetTrakAtom(); ASSERT(pTrakAtom); MP4Atom* pMoovAtom = FindAtom("moov"); ASSERT(pMoovAtom); RemoveTrackFromIod(trackId, ShallHaveIods()); RemoveTrackFromOd(trackId); if (trackId == m_odTrackId) { m_odTrackId = 0; } pMoovAtom->DeleteChildAtom(pTrakAtom); m_trakIds.Delete(trakIndex); m_pTracks.Delete(trackIndex); delete pTrack; delete pTrakAtom; } u_int32_t MP4File::GetNumberOfTracks(const char* type, u_int8_t subType) { if (type == NULL) { return m_pTracks.Size(); } u_int32_t typeSeen = 0; const char* normType = MP4NormalizeTrackType(type, m_verbosity); for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { if (!strcmp(normType, m_pTracks[i]->GetType())) { if (subType) { if (normType == MP4_AUDIO_TRACK_TYPE) { if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { continue; } } else if (normType == MP4_VIDEO_TRACK_TYPE) { if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { continue; } } // else unknown subtype, ignore it } typeSeen++; } } return typeSeen; } MP4TrackId MP4File::AllocTrackId() { MP4TrackId trackId = GetIntegerProperty("moov.mvhd.nextTrackId"); if (trackId <= 0xFFFF) { // check that nextTrackid is correct try { (void)FindTrackIndex(trackId); // ERROR, this trackId is in use } catch (MP4Error* e) { // OK, this trackId is not in use, proceed delete e; SetIntegerProperty("moov.mvhd.nextTrackId", trackId + 1); return trackId; } } // we need to search for a track id for (trackId = 1; trackId <= 0xFFFF; trackId++) { try { (void)FindTrackIndex(trackId); // KEEP LOOKING, this trackId is in use } catch (MP4Error* e) { // OK, this trackId is not in use, proceed delete e; return trackId; } } // extreme case where mp4 file has 2^16 tracks in it throw new MP4Error("too many existing tracks", "AddTrack"); return MP4_INVALID_TRACK_ID; // to keep MSVC happy } MP4TrackId MP4File::FindTrackId(u_int16_t trackIndex, const char* type, u_int8_t subType) { if (type == NULL) { return m_pTracks[trackIndex]->GetId(); } u_int32_t typeSeen = 0; const char* normType = MP4NormalizeTrackType(type, m_verbosity); for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { if (!strcmp(normType, m_pTracks[i]->GetType())) { if (subType) { if (normType == MP4_AUDIO_TRACK_TYPE) { if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { continue; } } else if (normType == MP4_VIDEO_TRACK_TYPE) { if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { continue; } } // else unknown subtype, ignore it } if (trackIndex == typeSeen) { return m_pTracks[i]->GetId(); } typeSeen++; } } throw new MP4Error("Track index doesn't exist - track %d type %s", "FindTrackId", trackIndex, type); return MP4_INVALID_TRACK_ID; // satisfy MS compiler } u_int16_t MP4File::FindTrackIndex(MP4TrackId trackId) { for (u_int32_t i = 0; i < m_pTracks.Size() && i <= 0xFFFF; i++) { if (m_pTracks[i]->GetId() == trackId) { return (u_int16_t)i; } } throw new MP4Error("Track id %d doesn't exist", "FindTrackIndex", trackId); return (u_int16_t)-1; // satisfy MS compiler } u_int16_t MP4File::FindTrakAtomIndex(MP4TrackId trackId) { if (trackId) { for (u_int32_t i = 0; i < m_trakIds.Size(); i++) { if (m_trakIds[i] == trackId) { return i; } } } throw new MP4Error("Track id %d doesn't exist", "FindTrakAtomIndex", trackId); return (u_int16_t)-1; // satisfy MS compiler } u_int32_t MP4File::GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId) { return m_pTracks[FindTrackIndex(trackId)]->GetSampleSize(sampleId); } u_int32_t MP4File::GetTrackMaxSampleSize(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]->GetMaxSampleSize(); } MP4SampleId MP4File::GetSampleIdFromTime(MP4TrackId trackId, MP4Timestamp when, bool wantSyncSample) { return m_pTracks[FindTrackIndex(trackId)]-> GetSampleIdFromTime(when, wantSyncSample); } MP4Timestamp MP4File::GetSampleTime( MP4TrackId trackId, MP4SampleId sampleId) { MP4Timestamp timestamp; m_pTracks[FindTrackIndex(trackId)]-> GetSampleTimes(sampleId, ×tamp, NULL); return timestamp; } MP4Duration MP4File::GetSampleDuration( MP4TrackId trackId, MP4SampleId sampleId) { MP4Duration duration; m_pTracks[FindTrackIndex(trackId)]-> GetSampleTimes(sampleId, NULL, &duration); return duration; } MP4Duration MP4File::GetSampleRenderingOffset( MP4TrackId trackId, MP4SampleId sampleId) { return m_pTracks[FindTrackIndex(trackId)]-> GetSampleRenderingOffset(sampleId); } bool MP4File::GetSampleSync(MP4TrackId trackId, MP4SampleId sampleId) { return m_pTracks[FindTrackIndex(trackId)]->IsSyncSample(sampleId); } void MP4File::ReadSample(MP4TrackId trackId, MP4SampleId sampleId, u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample) { m_pTracks[FindTrackIndex(trackId)]-> ReadSample(sampleId, ppBytes, pNumBytes, pStartTime, pDuration, pRenderingOffset, pIsSyncSample); } void MP4File::WriteSample(MP4TrackId trackId, const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample) { ProtectWriteOperation("MP4WriteSample"); m_pTracks[FindTrackIndex(trackId)]-> WriteSample(pBytes, numBytes, duration, renderingOffset, isSyncSample); m_pModificationProperty->SetValue(MP4GetAbsTimestamp()); } void MP4File::SetSampleRenderingOffset(MP4TrackId trackId, MP4SampleId sampleId, MP4Duration renderingOffset) { ProtectWriteOperation("MP4SetSampleRenderingOffset"); m_pTracks[FindTrackIndex(trackId)]-> SetSampleRenderingOffset(sampleId, renderingOffset); m_pModificationProperty->SetValue(MP4GetAbsTimestamp()); } char* MP4File::MakeTrackName(MP4TrackId trackId, const char* name) { u_int16_t trakIndex = FindTrakAtomIndex(trackId); if (name == NULL || name[0] == '\0') { snprintf(m_trakName, sizeof(m_trakName), "moov.trak[%u]", trakIndex); } else { snprintf(m_trakName, sizeof(m_trakName), "moov.trak[%u].%s", trakIndex, name); } return m_trakName; } MP4Atom *MP4File::FindTrackAtom (MP4TrackId trackId, const char *name) { return FindAtom(MakeTrackName(trackId, name)); } u_int64_t MP4File::GetTrackIntegerProperty(MP4TrackId trackId, const char* name) { return GetIntegerProperty(MakeTrackName(trackId, name)); } void MP4File::SetTrackIntegerProperty(MP4TrackId trackId, const char* name, int64_t value) { SetIntegerProperty(MakeTrackName(trackId, name), value); } float MP4File::GetTrackFloatProperty(MP4TrackId trackId, const char* name) { return GetFloatProperty(MakeTrackName(trackId, name)); } void MP4File::SetTrackFloatProperty(MP4TrackId trackId, const char* name, float value) { SetFloatProperty(MakeTrackName(trackId, name), value); } const char* MP4File::GetTrackStringProperty(MP4TrackId trackId, const char* name) { return GetStringProperty(MakeTrackName(trackId, name)); } void MP4File::SetTrackStringProperty(MP4TrackId trackId, const char* name, const char* value) { SetStringProperty(MakeTrackName(trackId, name), value); } void MP4File::GetTrackBytesProperty(MP4TrackId trackId, const char* name, u_int8_t** ppValue, u_int32_t* pValueSize) { GetBytesProperty(MakeTrackName(trackId, name), ppValue, pValueSize); } void MP4File::SetTrackBytesProperty(MP4TrackId trackId, const char* name, const u_int8_t* pValue, u_int32_t valueSize) { SetBytesProperty(MakeTrackName(trackId, name), pValue, valueSize); } // file level convenience functions MP4Duration MP4File::GetDuration() { return m_pDurationProperty->GetValue(); } void MP4File::SetDuration(MP4Duration value) { m_pDurationProperty->SetValue(value); } u_int32_t MP4File::GetTimeScale() { return m_pTimeScaleProperty->GetValue(); } void MP4File::SetTimeScale(u_int32_t value) { if (value == 0) { throw new MP4Error("invalid value", "SetTimeScale"); } m_pTimeScaleProperty->SetValue(value); } u_int8_t MP4File::GetODProfileLevel() { return GetIntegerProperty("moov.iods.ODProfileLevelId"); } void MP4File::SetODProfileLevel(u_int8_t value) { SetIntegerProperty("moov.iods.ODProfileLevelId", value); } u_int8_t MP4File::GetSceneProfileLevel() { return GetIntegerProperty("moov.iods.sceneProfileLevelId"); } void MP4File::SetSceneProfileLevel(u_int8_t value) { SetIntegerProperty("moov.iods.sceneProfileLevelId", value); } u_int8_t MP4File::GetVideoProfileLevel() { return GetIntegerProperty("moov.iods.visualProfileLevelId"); } void MP4File::SetVideoProfileLevel(u_int8_t value) { SetIntegerProperty("moov.iods.visualProfileLevelId", value); } u_int8_t MP4File::GetAudioProfileLevel() { return GetIntegerProperty("moov.iods.audioProfileLevelId"); } void MP4File::SetAudioProfileLevel(u_int8_t value) { SetIntegerProperty("moov.iods.audioProfileLevelId", value); } u_int8_t MP4File::GetGraphicsProfileLevel() { return GetIntegerProperty("moov.iods.graphicsProfileLevelId"); } void MP4File::SetGraphicsProfileLevel(u_int8_t value) { SetIntegerProperty("moov.iods.graphicsProfileLevelId", value); } const char* MP4File::GetSessionSdp() { return GetStringProperty("moov.udta.hnti.rtp .sdpText"); } void MP4File::SetSessionSdp(const char* sdpString) { (void)AddDescendantAtoms("moov", "udta.hnti.rtp "); SetStringProperty("moov.udta.hnti.rtp .sdpText", sdpString); } void MP4File::AppendSessionSdp(const char* sdpFragment) { const char* oldSdpString = NULL; try { oldSdpString = GetSessionSdp(); } catch (MP4Error* e) { delete e; SetSessionSdp(sdpFragment); return; } char* newSdpString = (char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1); strcpy(newSdpString, oldSdpString); strcat(newSdpString, sdpFragment); SetSessionSdp(newSdpString); MP4Free(newSdpString); } // // ismacrypt API - retrieve OriginalFormatBox // // parameters are assumed to have been sanity tested in mp4.cpp // don't call this unless media data name is 'encv', // results may otherwise be unpredictable. // // input: // trackID - valid encv track ID for this file // buflen - length of oFormat, minimum is 5 (4cc plus null terminator) // // output: // oFormat - buffer to return null terminated string containing // track original format // return: // 0 - original format returned OK // 1 - buffer length error or problem retrieving track property // // bool MP4File::GetTrackMediaDataOriginalFormat(MP4TrackId trackId, char *originalFormat, u_int32_t buflen) { u_int32_t format; if (buflen < 5) return false; format = GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.sinf.frma.data-format"); IDATOM(format, originalFormat); return true; } // track level convenience functions MP4SampleId MP4File::GetTrackNumberOfSamples(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]->GetNumberOfSamples(); } const char* MP4File::GetTrackType(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]->GetType(); } const char *MP4File::GetTrackMediaDataName (MP4TrackId trackId) { MP4Atom *pChild; MP4Atom *pAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd")); if (pAtom->GetNumberOfChildAtoms() != 1) { VERBOSE_ERROR(m_verbosity, fprintf(stderr, "track %d has more than 1 child atoms in stsd\n", trackId)); return NULL; } pChild = pAtom->GetChildAtom(0); return pChild->GetType(); } u_int32_t MP4File::GetTrackTimeScale(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]->GetTimeScale(); } void MP4File::SetTrackTimeScale(MP4TrackId trackId, u_int32_t value) { if (value == 0) { throw new MP4Error("invalid value", "SetTrackTimeScale"); } SetTrackIntegerProperty(trackId, "mdia.mdhd.timeScale", value); } MP4Duration MP4File::GetTrackDuration(MP4TrackId trackId) { return GetTrackIntegerProperty(trackId, "mdia.mdhd.duration"); } u_int8_t MP4File::GetTrackEsdsObjectTypeId(MP4TrackId trackId) { // changed mp4a to * to handle enca case try { return GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId"); } catch (MP4Error *e) { delete e; return GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.*.esds.decConfigDescr.objectTypeId"); } } u_int8_t MP4File::GetTrackAudioMpeg4Type(MP4TrackId trackId) { // verify that track is an MPEG-4 audio track if (GetTrackEsdsObjectTypeId(trackId) != MP4_MPEG4_AUDIO_TYPE) { return MP4_MPEG4_INVALID_AUDIO_TYPE; } u_int8_t* pEsConfig = NULL; u_int32_t esConfigSize; // The Mpeg4 audio type (AAC, CELP, HXVC, ...) // is the first 5 bits of the ES configuration GetTrackESConfiguration(trackId, &pEsConfig, &esConfigSize); if (esConfigSize < 1) { free(pEsConfig); return MP4_MPEG4_INVALID_AUDIO_TYPE; } u_int8_t mpeg4Type = ((pEsConfig[0] >> 3) & 0x1f); // TTTT TXXX XXX potentially 6 bits of extension. if (mpeg4Type == 0x1f) { if (esConfigSize < 2) { free(pEsConfig); return MP4_MPEG4_INVALID_AUDIO_TYPE; } mpeg4Type = 32 + (((pEsConfig[0] & 0x7) << 3) | ((pEsConfig[1] >> 5) & 0x7)); } free(pEsConfig); return mpeg4Type; } MP4Duration MP4File::GetTrackFixedSampleDuration(MP4TrackId trackId) { return m_pTracks[FindTrackIndex(trackId)]->GetFixedSampleDuration(); } double MP4File::GetTrackVideoFrameRate(MP4TrackId trackId) { MP4SampleId numSamples = GetTrackNumberOfSamples(trackId); u_int64_t msDuration = ConvertFromTrackDuration(trackId, GetTrackDuration(trackId), MP4_MSECS_TIME_SCALE); if (msDuration == 0) { return 0.0; } return ((double)numSamples / UINT64_TO_DOUBLE(msDuration)) * MP4_MSECS_TIME_SCALE; } int MP4File::GetTrackAudioChannels (MP4TrackId trackId) { return GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*[0].channels"); } // true if media track encrypted according to ismacryp bool MP4File::IsIsmaCrypMediaTrack(MP4TrackId trackId) { if (GetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.*.sinf.frma.data-format") != (u_int64_t)-1) { return true; } return false; } void MP4File::GetTrackESConfiguration(MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize) { try { GetTrackBytesProperty(trackId, "mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo[0].info", ppConfig, pConfigSize); } catch (MP4Error *e) { delete e; GetTrackBytesProperty(trackId, "mdia.minf.stbl.stsd.*[0].*.esds.decConfigDescr.decSpecificInfo[0].info", ppConfig, pConfigSize); } } void MP4File::GetTrackVideoMetadata(MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize) { GetTrackBytesProperty(trackId, "mdia.minf.stbl.stsd.*[0].*.metadata", ppConfig, pConfigSize); } void MP4File::SetTrackESConfiguration(MP4TrackId trackId, const u_int8_t* pConfig, u_int32_t configSize) { // get a handle on the track decoder config descriptor MP4DescriptorProperty* pConfigDescrProperty = NULL; if (FindProperty(MakeTrackName(trackId, "mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo"), (MP4Property**)&pConfigDescrProperty) == false || pConfigDescrProperty == NULL) { // probably trackId refers to a hint track throw new MP4Error("no such property", "MP4SetTrackESConfiguration"); } // lookup the property to store the configuration MP4BytesProperty* pInfoProperty = NULL; (void)pConfigDescrProperty->FindProperty("decSpecificInfo[0].info", (MP4Property**)&pInfoProperty); // configuration being set for the first time if (pInfoProperty == NULL) { // need to create a new descriptor to hold it MP4Descriptor* pConfigDescr = pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag); pConfigDescr->Generate(); (void)pConfigDescrProperty->FindProperty( "decSpecificInfo[0].info", (MP4Property**)&pInfoProperty); ASSERT(pInfoProperty); } // set the value pInfoProperty->SetValue(pConfig, configSize); } void MP4File::GetTrackH264SeqPictHeaders (MP4TrackId trackId, uint8_t ***pppSeqHeader, uint32_t **ppSeqHeaderSize, uint8_t ***pppPictHeader, uint32_t **ppPictHeaderSize) { uint32_t count; const char *format; MP4Atom *avcCAtom; *pppSeqHeader = NULL; *pppPictHeader = NULL; *ppSeqHeaderSize = NULL; *ppPictHeaderSize = NULL; // get 4cc media format - can be avc1 or encv for ismacrypted track format = GetTrackMediaDataName (trackId); if (!strcasecmp(format, "avc1")) avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1.avcC")); else if (!strcasecmp(format, "encv")) avcCAtom = FindAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.encv.avcC")); else // huh? unknown track format return; MP4BitfieldProperty *pSeqCount; MP4IntegerProperty *pSeqLen, *pPictCount, *pPictLen; MP4BytesProperty *pSeqVal, *pPictVal; if ((avcCAtom->FindProperty("avcC.numOfSequenceParameterSets", (MP4Property **)&pSeqCount) == false) || (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetLength", (MP4Property **)&pSeqLen) == false) || (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetNALUnit", (MP4Property **)&pSeqVal) == false)) { VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties")); return ; } uint8_t **ppSeqHeader = (uint8_t **)malloc((pSeqCount->GetValue() + 1) * sizeof(uint8_t *)); if (ppSeqHeader == NULL) return; *pppSeqHeader = ppSeqHeader; uint32_t *pSeqHeaderSize = (uint32_t *)malloc((pSeqCount->GetValue() + 1) * sizeof(uint32_t *)); if (pSeqHeaderSize == NULL) return; *ppSeqHeaderSize = pSeqHeaderSize; for (count = 0; count < pSeqCount->GetValue(); count++) { pSeqVal->GetValue(&(ppSeqHeader[count]), &(pSeqHeaderSize[count]), count); } ppSeqHeader[count] = NULL; pSeqHeaderSize[count] = 0; if ((avcCAtom->FindProperty("avcC.numOfPictureParameterSets", (MP4Property **)&pPictCount) == false) || (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetLength", (MP4Property **)&pPictLen) == false) || (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetNALUnit", (MP4Property **)&pPictVal) == false)) { VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC picture table properties")); return ; } uint8_t **ppPictHeader = (uint8_t **)malloc((pPictCount->GetValue() + 1) * sizeof(uint8_t *)); if (ppPictHeader == NULL) return; uint32_t *pPictHeaderSize = (uint32_t *)malloc((pPictCount->GetValue() + 1)* sizeof(uint32_t *)); if (pPictHeaderSize == NULL) { free(ppPictHeader); return; } *pppPictHeader = ppPictHeader; *ppPictHeaderSize = pPictHeaderSize; for (count = 0; count < pPictCount->GetValue(); count++) { pPictVal->GetValue(&(ppPictHeader[count]), &(pPictHeaderSize[count]), count); } ppPictHeader[count] = NULL; pPictHeaderSize[count] = 0; return ; } const char* MP4File::GetHintTrackSdp(MP4TrackId hintTrackId) { return GetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText"); } void MP4File::SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4SetHintTrackSdp"); } (void)AddDescendantAtoms( MakeTrackName(hintTrackId, NULL), "udta.hnti.sdp "); SetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText", sdpString); } void MP4File::AppendHintTrackSdp(MP4TrackId hintTrackId, const char* sdpFragment) { const char* oldSdpString = NULL; try { oldSdpString = GetHintTrackSdp(hintTrackId); } catch (MP4Error* e) { delete e; SetHintTrackSdp(hintTrackId, sdpFragment); return; } char* newSdpString = (char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1); strcpy(newSdpString, oldSdpString); strcat(newSdpString, sdpFragment); SetHintTrackSdp(hintTrackId, newSdpString); MP4Free(newSdpString); } void MP4File::GetHintTrackRtpPayload( MP4TrackId hintTrackId, char** ppPayloadName, u_int8_t* pPayloadNumber, u_int16_t* pMaxPayloadSize, char **ppEncodingParams) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetHintTrackRtpPayload"); } ((MP4RtpHintTrack*)pTrack)->GetPayload( ppPayloadName, pPayloadNumber, pMaxPayloadSize, ppEncodingParams); } void MP4File::SetHintTrackRtpPayload(MP4TrackId hintTrackId, const char* payloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize, const char *encoding_params, bool include_rtp_map, bool include_mpeg4_esid) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4SetHintTrackRtpPayload"); } u_int8_t payloadNumber; if (pPayloadNumber && *pPayloadNumber != MP4_SET_DYNAMIC_PAYLOAD) { payloadNumber = *pPayloadNumber; } else { payloadNumber = AllocRtpPayloadNumber(); if (pPayloadNumber) { *pPayloadNumber = payloadNumber; } } ((MP4RtpHintTrack*)pTrack)->SetPayload( payloadName, payloadNumber, maxPayloadSize, encoding_params, include_rtp_map, include_mpeg4_esid); } u_int8_t MP4File::AllocRtpPayloadNumber() { MP4Integer32Array usedPayloads; u_int32_t i; // collect rtp payload numbers in use by existing tracks for (i = 0; i < m_pTracks.Size(); i++) { MP4Atom* pTrakAtom = m_pTracks[i]->GetTrakAtom(); MP4Integer32Property* pPayloadProperty = NULL; if (pTrakAtom->FindProperty("trak.udta.hinf.payt.payloadNumber", (MP4Property**)&pPayloadProperty) && pPayloadProperty) { usedPayloads.Add(pPayloadProperty->GetValue()); } } // search dynamic payload range for an available slot u_int8_t payload; for (payload = 96; payload < 128; payload++) { for (i = 0; i < usedPayloads.Size(); i++) { if (payload == usedPayloads[i]) { break; } } if (i == usedPayloads.Size()) { break; } } if (payload >= 128) { throw new MP4Error("no more available rtp payload numbers", "AllocRtpPayloadNumber"); } return payload; } MP4TrackId MP4File::GetHintTrackReferenceTrackId( MP4TrackId hintTrackId) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetHintTrackReferenceTrackId"); } MP4Track* pRefTrack = ((MP4RtpHintTrack*)pTrack)->GetRefTrack(); if (pRefTrack == NULL) { return MP4_INVALID_TRACK_ID; } return pRefTrack->GetId(); } void MP4File::ReadRtpHint( MP4TrackId hintTrackId, MP4SampleId hintSampleId, u_int16_t* pNumPackets) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4ReadRtpHint"); } ((MP4RtpHintTrack*)pTrack)-> ReadHint(hintSampleId, pNumPackets); } u_int16_t MP4File::GetRtpHintNumberOfPackets( MP4TrackId hintTrackId) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetRtpHintNumberOfPackets"); } return ((MP4RtpHintTrack*)pTrack)->GetHintNumberOfPackets(); } int8_t MP4File::GetRtpPacketBFrame( MP4TrackId hintTrackId, u_int16_t packetIndex) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetRtpHintBFrame"); } return ((MP4RtpHintTrack*)pTrack)->GetPacketBFrame(packetIndex); } int32_t MP4File::GetRtpPacketTransmitOffset( MP4TrackId hintTrackId, u_int16_t packetIndex) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetRtpPacketTransmitOffset"); } return ((MP4RtpHintTrack*)pTrack)->GetPacketTransmitOffset(packetIndex); } void MP4File::ReadRtpPacket( MP4TrackId hintTrackId, u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc, bool includeHeader, bool includePayload) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4ReadPacket"); } ((MP4RtpHintTrack*)pTrack)->ReadPacket( packetIndex, ppBytes, pNumBytes, ssrc, includeHeader, includePayload); } MP4Timestamp MP4File::GetRtpTimestampStart( MP4TrackId hintTrackId) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4GetRtpTimestampStart"); } return ((MP4RtpHintTrack*)pTrack)->GetRtpTimestampStart(); } void MP4File::SetRtpTimestampStart( MP4TrackId hintTrackId, MP4Timestamp rtpStart) { MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4SetRtpTimestampStart"); } ((MP4RtpHintTrack*)pTrack)->SetRtpTimestampStart(rtpStart); } void MP4File::AddRtpHint(MP4TrackId hintTrackId, bool isBframe, u_int32_t timestampOffset) { ProtectWriteOperation("MP4AddRtpHint"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4AddRtpHint"); } ((MP4RtpHintTrack*)pTrack)->AddHint(isBframe, timestampOffset); } void MP4File::AddRtpPacket( MP4TrackId hintTrackId, bool setMbit, int32_t transmitOffset) { ProtectWriteOperation("MP4AddRtpPacket"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4AddRtpPacket"); } ((MP4RtpHintTrack*)pTrack)->AddPacket(setMbit, transmitOffset); } void MP4File::AddRtpImmediateData(MP4TrackId hintTrackId, const u_int8_t* pBytes, u_int32_t numBytes) { ProtectWriteOperation("MP4AddRtpImmediateData"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4AddRtpImmediateData"); } ((MP4RtpHintTrack*)pTrack)->AddImmediateData(pBytes, numBytes); } void MP4File::AddRtpSampleData(MP4TrackId hintTrackId, MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength) { ProtectWriteOperation("MP4AddRtpSampleData"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4AddRtpSampleData"); } ((MP4RtpHintTrack*)pTrack)->AddSampleData( sampleId, dataOffset, dataLength); } void MP4File::AddRtpESConfigurationPacket(MP4TrackId hintTrackId) { ProtectWriteOperation("MP4AddRtpESConfigurationPacket"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4AddRtpESConfigurationPacket"); } ((MP4RtpHintTrack*)pTrack)->AddESConfigurationPacket(); } void MP4File::WriteRtpHint(MP4TrackId hintTrackId, MP4Duration duration, bool isSyncSample) { ProtectWriteOperation("MP4WriteRtpHint"); MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { throw new MP4Error("track is not a hint track", "MP4WriteRtpHint"); } ((MP4RtpHintTrack*)pTrack)->WriteHint(duration, isSyncSample); } u_int64_t MP4File::ConvertFromMovieDuration( MP4Duration duration, u_int32_t timeScale) { return MP4ConvertTime((u_int64_t)duration, GetTimeScale(), timeScale); } u_int64_t MP4File::ConvertFromTrackTimestamp( MP4TrackId trackId, MP4Timestamp timeStamp, u_int32_t timeScale) { return MP4ConvertTime(timeStamp, GetTrackTimeScale(trackId), timeScale); } MP4Timestamp MP4File::ConvertToTrackTimestamp( MP4TrackId trackId, u_int64_t timeStamp, u_int32_t timeScale) { return (MP4Timestamp)MP4ConvertTime(timeStamp, timeScale, GetTrackTimeScale(trackId)); } u_int64_t MP4File::ConvertFromTrackDuration( MP4TrackId trackId, MP4Duration duration, u_int32_t timeScale) { return MP4ConvertTime((u_int64_t)duration, GetTrackTimeScale(trackId), timeScale); } MP4Duration MP4File::ConvertToTrackDuration( MP4TrackId trackId, u_int64_t duration, u_int32_t timeScale) { return (MP4Duration)MP4ConvertTime(duration, timeScale, GetTrackTimeScale(trackId)); } u_int8_t MP4File::ConvertTrackTypeToStreamType(const char* trackType) { u_int8_t streamType; if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) { streamType = MP4ObjectDescriptionStreamType; } else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) { streamType = MP4SceneDescriptionStreamType; } else if (!strcmp(trackType, MP4_CLOCK_TRACK_TYPE)) { streamType = MP4ClockReferenceStreamType; } else if (!strcmp(trackType, MP4_MPEG7_TRACK_TYPE)) { streamType = MP4Mpeg7StreamType; } else if (!strcmp(trackType, MP4_OCI_TRACK_TYPE)) { streamType = MP4OCIStreamType; } else if (!strcmp(trackType, MP4_IPMP_TRACK_TYPE)) { streamType = MP4IPMPStreamType; } else if (!strcmp(trackType, MP4_MPEGJ_TRACK_TYPE)) { streamType = MP4MPEGJStreamType; } else { streamType = MP4UserPrivateStreamType; } return streamType; } // edit list char* MP4File::MakeTrackEditName( MP4TrackId trackId, MP4EditId editId, const char* name) { char* trakName = MakeTrackName(trackId, NULL); if (m_editName == NULL) { m_editName = (char *)malloc(1024); if (m_editName == NULL) return NULL; } snprintf(m_editName, 1024, "%s.edts.elst.entries[%u].%s", trakName, editId - 1, name); return m_editName; } MP4EditId MP4File::AddTrackEdit( MP4TrackId trackId, MP4EditId editId) { ProtectWriteOperation("AddTrackEdit"); return m_pTracks[FindTrackIndex(trackId)]->AddEdit(editId); } void MP4File::DeleteTrackEdit( MP4TrackId trackId, MP4EditId editId) { ProtectWriteOperation("DeleteTrackEdit"); m_pTracks[FindTrackIndex(trackId)]->DeleteEdit(editId); } u_int32_t MP4File::GetTrackNumberOfEdits( MP4TrackId trackId) { return GetTrackIntegerProperty(trackId, "edts.elst.entryCount"); } MP4Duration MP4File::GetTrackEditTotalDuration( MP4TrackId trackId, MP4EditId editId) { return m_pTracks[FindTrackIndex(trackId)]->GetEditTotalDuration(editId); } MP4Timestamp MP4File::GetTrackEditStart( MP4TrackId trackId, MP4EditId editId) { return m_pTracks[FindTrackIndex(trackId)]->GetEditStart(editId); } MP4Timestamp MP4File::GetTrackEditMediaStart( MP4TrackId trackId, MP4EditId editId) { return GetIntegerProperty( MakeTrackEditName(trackId, editId, "mediaTime")); } void MP4File::SetTrackEditMediaStart( MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime) { SetIntegerProperty( MakeTrackEditName(trackId, editId, "mediaTime"), startTime); } MP4Duration MP4File::GetTrackEditDuration( MP4TrackId trackId, MP4EditId editId) { return GetIntegerProperty( MakeTrackEditName(trackId, editId, "segmentDuration")); } void MP4File::SetTrackEditDuration( MP4TrackId trackId, MP4EditId editId, MP4Duration duration) { SetIntegerProperty( MakeTrackEditName(trackId, editId, "segmentDuration"), duration); } bool MP4File::GetTrackEditDwell( MP4TrackId trackId, MP4EditId editId) { return (GetIntegerProperty( MakeTrackEditName(trackId, editId, "mediaRate")) == 0); } void MP4File::SetTrackEditDwell( MP4TrackId trackId, MP4EditId editId, bool dwell) { SetIntegerProperty( MakeTrackEditName(trackId, editId, "mediaRate"), (dwell ? 0 : 1)); } MP4SampleId MP4File::GetSampleIdFromEditTime( MP4TrackId trackId, MP4Timestamp when, MP4Timestamp* pStartTime, MP4Duration* pDuration) { return m_pTracks[FindTrackIndex(trackId)]->GetSampleIdFromEditTime( when, pStartTime, pDuration); } faac-1.28/common/mp4v2/mp4file.h0000644010307701030770000005427311136736372020041 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #ifndef __MP4_FILE_INCLUDED__ #define __MP4_FILE_INCLUDED__ // forward declarations class MP4Atom; class MP4Property; class MP4Float32Property; class MP4StringProperty; class MP4BytesProperty; class MP4Descriptor; class MP4DescriptorProperty; struct Virtual_IO; class MP4File { public: /* equivalent to MP4 library API */ MP4File(u_int32_t verbosity = 0); ~MP4File(); /* file operations */ void Read(const char* fileName); #ifdef _WIN32 void Read(const wchar_t* fileName); #endif void ReadEx(const char *fileName, void *user, Virtual_IO *virtual_IO); //benski> void Create(const char* fileName, u_int32_t flags, int add_ftyp = 1, int add_iods = 1, char* majorBrand = NULL, u_int32_t minorVersion = 0, char** supportedBrands = NULL, u_int32_t supportedBrandsCount = 0); bool Modify(const char* fileName); void Optimize(const char* orgFileName, const char* newFileName = NULL); void Dump(FILE* pDumpFile = NULL, bool dumpImplicits = false); void Close(); /* library property per file */ u_int32_t GetVerbosity() { return m_verbosity; } void SetVerbosity(u_int32_t verbosity) { m_verbosity = verbosity; } bool Use64Bits(const char *atomName); void Check64BitStatus(const char *atomName); /* file properties */ u_int64_t GetIntegerProperty(const char* name); float GetFloatProperty(const char* name); const char* GetStringProperty(const char* name); void GetBytesProperty(const char* name, u_int8_t** ppValue, u_int32_t* pValueSize); void SetIntegerProperty(const char* name, u_int64_t value); void SetFloatProperty(const char* name, float value); void SetStringProperty(const char* name, const char* value); void SetBytesProperty(const char* name, const u_int8_t* pValue, u_int32_t valueSize); // file level convenience functions MP4Duration GetDuration(); void SetDuration(MP4Duration value); u_int32_t GetTimeScale(); void SetTimeScale(u_int32_t value); u_int8_t GetODProfileLevel(); void SetODProfileLevel(u_int8_t value); u_int8_t GetSceneProfileLevel(); void SetSceneProfileLevel(u_int8_t value); u_int8_t GetVideoProfileLevel(); void SetVideoProfileLevel(u_int8_t value); u_int8_t GetAudioProfileLevel(); void SetAudioProfileLevel(u_int8_t value); u_int8_t GetGraphicsProfileLevel(); void SetGraphicsProfileLevel(u_int8_t value); const char* GetSessionSdp(); void SetSessionSdp(const char* sdpString); void AppendSessionSdp(const char* sdpString); /* track operations */ MP4TrackId AddTrack(const char* type, u_int32_t timeScale = 1000); void DeleteTrack(MP4TrackId trackId); u_int32_t GetNumberOfTracks(const char* type = NULL, u_int8_t subType = 0); MP4TrackId AllocTrackId(); MP4TrackId FindTrackId(u_int16_t trackIndex, const char* type = NULL, u_int8_t subType = 0); u_int16_t FindTrackIndex(MP4TrackId trackId); u_int16_t FindTrakAtomIndex(MP4TrackId trackId); /* track properties */ MP4Atom *FindTrackAtom(MP4TrackId trackId, const char *name); u_int64_t GetTrackIntegerProperty( MP4TrackId trackId, const char* name); float GetTrackFloatProperty( MP4TrackId trackId, const char* name); const char* GetTrackStringProperty( MP4TrackId trackId, const char* name); void GetTrackBytesProperty( MP4TrackId trackId, const char* name, u_int8_t** ppValue, u_int32_t* pValueSize); void SetTrackIntegerProperty( MP4TrackId trackId, const char* name, int64_t value); void SetTrackFloatProperty( MP4TrackId trackId, const char* name, float value); void SetTrackStringProperty( MP4TrackId trackId, const char* name, const char* value); void SetTrackBytesProperty( MP4TrackId trackId, const char* name, const u_int8_t* pValue, u_int32_t valueSize); /* sample operations */ u_int32_t GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId); u_int32_t GetTrackMaxSampleSize(MP4TrackId trackId); MP4SampleId GetSampleIdFromTime(MP4TrackId trackId, MP4Timestamp when, bool wantSyncSample = false); MP4Timestamp GetSampleTime( MP4TrackId trackId, MP4SampleId sampleId); MP4Duration GetSampleDuration( MP4TrackId trackId, MP4SampleId sampleId); MP4Duration GetSampleRenderingOffset( MP4TrackId trackId, MP4SampleId sampleId); bool GetSampleSync( MP4TrackId trackId, MP4SampleId sampleId); void ReadSample( // input parameters MP4TrackId trackId, MP4SampleId sampleId, // output parameters u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime = NULL, MP4Duration* pDuration = NULL, MP4Duration* pRenderingOffset = NULL, bool* pIsSyncSample = NULL); void WriteSample( MP4TrackId trackId, const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration = 0, MP4Duration renderingOffset = 0, bool isSyncSample = true); void SetSampleRenderingOffset( MP4TrackId trackId, MP4SampleId sampleId, MP4Duration renderingOffset); /* track level convenience functions */ MP4TrackId AddSystemsTrack(const char* type); MP4TrackId AddODTrack(); MP4TrackId AddSceneTrack(); MP4TrackId AddAudioTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType); MP4TrackId AddEncAudioTrack( // ismacryp u_int32_t timeScale, MP4Duration sampleDuration, u_int8_t audioType, u_int32_t scheme_type, u_int16_t scheme_version, u_int8_t key_ind_len, u_int8_t iv_len, bool selective_enc, const char *kms_uri, bool use_ismacryp); void SetAmrVendor( MP4TrackId trackId, u_int32_t vendor); void SetAmrDecoderVersion( MP4TrackId trackId, u_int8_t decoderVersion); void SetAmrModeSet( MP4TrackId trackId, u_int16_t modeSet); uint16_t GetAmrModeSet(MP4TrackId trackId); MP4TrackId AddAmrAudioTrack( u_int32_t timeScale, u_int16_t modeSet, u_int8_t modeChangePeriod, u_int8_t framesPerSample, bool isAmrWB); MP4TrackId AddHrefTrack(uint32_t timeScale, MP4Duration sampleDuration, const char *base_url); MP4TrackId AddMP4VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType); MP4TrackId AddEncVideoTrack( // ismacryp u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t videoType, mp4v2_ismacrypParams *icPp, const char *oFormat); void SetH263Vendor( MP4TrackId trackId, u_int32_t vendor); void SetH263DecoderVersion( MP4TrackId trackId, u_int8_t decoderVersion); void SetH263Bitrates( MP4TrackId, u_int32_t avgBitrate, u_int32_t maxBitrate); MP4TrackId AddH263VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, u_int8_t h263Level, u_int8_t h263Profile, u_int32_t avgBitrate, u_int32_t maxBitrate); MP4TrackId AddH264VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, uint8_t AVCProfileIndication, uint8_t profile_compat, uint8_t AVCLevelIndication, uint8_t sampleLenFieldSizeMinusOne); MP4TrackId AddEncH264VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, MP4Atom *srcAtom, mp4v2_ismacrypParams *icPp); void AddH264SequenceParameterSet(MP4TrackId trackId, const uint8_t *pSequence, uint16_t sequenceLen); void AddH264PictureParameterSet(MP4TrackId trackId, const uint8_t *pPicture, uint16_t pictureLen); MP4TrackId AddHintTrack(MP4TrackId refTrackId); MP4TrackId AddTextTrack(MP4TrackId refTrackId); MP4TrackId AddChapterTextTrack(MP4TrackId refTrackId); MP4SampleId GetTrackNumberOfSamples(MP4TrackId trackId); const char* GetTrackType(MP4TrackId trackId); const char *GetTrackMediaDataName(MP4TrackId trackId); bool GetTrackMediaDataOriginalFormat(MP4TrackId trackId, char *originalFormat, u_int32_t buflen); MP4Duration GetTrackDuration(MP4TrackId trackId); u_int32_t GetTrackTimeScale(MP4TrackId trackId); void SetTrackTimeScale(MP4TrackId trackId, u_int32_t value); // replacement to GetTrackAudioType and GetTrackVideoType u_int8_t GetTrackEsdsObjectTypeId(MP4TrackId trackId); u_int8_t GetTrackAudioMpeg4Type(MP4TrackId trackId); MP4Duration GetTrackFixedSampleDuration(MP4TrackId trackId); double GetTrackVideoFrameRate(MP4TrackId trackId); int GetTrackAudioChannels(MP4TrackId trackId); void GetTrackESConfiguration(MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize); void SetTrackESConfiguration(MP4TrackId trackId, const u_int8_t* pConfig, u_int32_t configSize); void GetTrackVideoMetadata(MP4TrackId trackId, u_int8_t** ppConfig, u_int32_t* pConfigSize); void GetTrackH264SeqPictHeaders(MP4TrackId trackId, uint8_t ***pSeqHeader, uint32_t **pSeqHeaderSize, uint8_t ***pPictHeader, uint32_t **pPictHeaderSize); const char* GetHintTrackSdp(MP4TrackId hintTrackId); void SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString); void AppendHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString); // 3GPP specific functions void MakeFtypAtom(char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount); void Make3GPCompliant(const char* fileName, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount, bool deleteIodsAtom); // ISMA specific functions // true if media track encrypted according to ismacryp bool IsIsmaCrypMediaTrack(MP4TrackId trackId); void MakeIsmaCompliant(bool addIsmaComplianceSdp = true); void CreateIsmaIodFromParams( u_int8_t videoProfile, u_int32_t videoBitrate, u_int8_t* videoConfig, u_int32_t videoConfigLength, u_int8_t audioProfile, u_int32_t audioBitrate, u_int8_t* audioConfig, u_int32_t audioConfigLength, u_int8_t** ppBytes, u_int64_t* pNumBytes); // time convenience functions u_int64_t ConvertFromMovieDuration( MP4Duration duration, u_int32_t timeScale); u_int64_t ConvertFromTrackTimestamp( MP4TrackId trackId, MP4Timestamp timeStamp, u_int32_t timeScale); MP4Timestamp ConvertToTrackTimestamp( MP4TrackId trackId, u_int64_t timeStamp, u_int32_t timeScale); u_int64_t ConvertFromTrackDuration( MP4TrackId trackId, MP4Duration duration, u_int32_t timeScale); MP4Duration ConvertToTrackDuration( MP4TrackId trackId, u_int64_t duration, u_int32_t timeScale); // specialized operations void GetHintTrackRtpPayload( MP4TrackId hintTrackId, char** ppPayloadName = NULL, u_int8_t* pPayloadNumber = NULL, u_int16_t* pMaxPayloadSize = NULL, char **ppEncodingParams = NULL); void SetHintTrackRtpPayload( MP4TrackId hintTrackId, const char* payloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize, const char *encoding_params, bool include_rtp_map, bool include_mpeg4_esid); MP4TrackId GetHintTrackReferenceTrackId( MP4TrackId hintTrackId); void ReadRtpHint( MP4TrackId hintTrackId, MP4SampleId hintSampleId, u_int16_t* pNumPackets = NULL); u_int16_t GetRtpHintNumberOfPackets( MP4TrackId hintTrackId); int8_t GetRtpPacketBFrame( MP4TrackId hintTrackId, u_int16_t packetIndex); int32_t GetRtpPacketTransmitOffset( MP4TrackId hintTrackId, u_int16_t packetIndex); void ReadRtpPacket( MP4TrackId hintTrackId, u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc = 0, bool includeHeader = true, bool includePayload = true); MP4Timestamp GetRtpTimestampStart( MP4TrackId hintTrackId); void SetRtpTimestampStart( MP4TrackId hintTrackId, MP4Timestamp rtpStart); void AddRtpHint( MP4TrackId hintTrackId, bool isBframe, u_int32_t timestampOffset); void AddRtpPacket( MP4TrackId hintTrackId, bool setMbit, int32_t transmitOffset); void AddRtpImmediateData( MP4TrackId hintTrackId, const u_int8_t* pBytes, u_int32_t numBytes); void AddRtpSampleData( MP4TrackId hintTrackId, MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength); void AddRtpESConfigurationPacket( MP4TrackId hintTrackId); void WriteRtpHint( MP4TrackId hintTrackId, MP4Duration duration, bool isSyncSample); u_int8_t AllocRtpPayloadNumber(); // edit list related char* MakeTrackEditName( MP4TrackId trackId, MP4EditId editId, const char* name); MP4EditId AddTrackEdit( MP4TrackId trackId, MP4EditId editId = MP4_INVALID_EDIT_ID); void DeleteTrackEdit( MP4TrackId trackId, MP4EditId editId); u_int32_t GetTrackNumberOfEdits( MP4TrackId trackId); MP4Timestamp GetTrackEditStart( MP4TrackId trackId, MP4EditId editId); MP4Duration GetTrackEditTotalDuration( MP4TrackId trackId, MP4EditId editId); MP4Timestamp GetTrackEditMediaStart( MP4TrackId trackId, MP4EditId editId); void SetTrackEditMediaStart( MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime); MP4Duration GetTrackEditDuration( MP4TrackId trackId, MP4EditId editId); void SetTrackEditDuration( MP4TrackId trackId, MP4EditId editId, MP4Duration duration); bool GetTrackEditDwell( MP4TrackId trackId, MP4EditId editId); void SetTrackEditDwell( MP4TrackId trackId, MP4EditId editId, bool dwell); MP4SampleId GetSampleIdFromEditTime( MP4TrackId trackId, MP4Timestamp when, MP4Timestamp* pStartTime = NULL, MP4Duration* pDuration = NULL); /* iTunes metadata handling */ protected: bool CreateMetadataAtom(const char* name); public: // these are public to remove a lot of unnecessary routines bool DeleteMetadataAtom(const char* name, bool try_udta = false); bool GetMetadataString(const char *atom, char **value, bool try_udta = false); bool SetMetadataString(const char *atom, const char *value); bool MetadataDelete(void); bool SetMetadataUint8(const char *atom, u_int8_t compilation); bool GetMetadataUint8(const char *atom, u_int8_t* compilation); /* set metadata */ bool SetMetadataTrack(u_int16_t track, u_int16_t totalTracks); bool SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks); bool SetMetadataGenre(const char *value); bool SetMetadataTempo(u_int16_t tempo); bool SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size); bool SetMetadataFreeForm(const char *name, const u_int8_t* pValue, u_int32_t valueSize, const char *owner = NULL); /* get metadata */ bool GetMetadataByIndex(u_int32_t index, char** ppName, // free memory when done u_int8_t** ppValue, // free memory when done u_int32_t* pValueSize); bool GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks); bool GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks); bool GetMetadataGenre(char **value); bool GetMetadataTempo(u_int16_t* tempo); bool GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t* size, uint32_t index = 0); u_int32_t GetMetadataCoverArtCount(void); bool GetMetadataFreeForm(const char *name, u_int8_t** pValue, u_int32_t* valueSize, const char *owner = NULL); /* delete metadata */ bool DeleteMetadataGenre(); bool DeleteMetadataFreeForm(const char *name, const char *owner = NULL); /* end of MP4 API */ /* "protected" interface to be used only by friends in library */ u_int64_t GetPosition(FILE* pFile = NULL); void SetPosition(u_int64_t pos, FILE* pFile = NULL); u_int64_t GetSize(); void ReadBytes( u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); u_int64_t ReadUInt(u_int8_t size); u_int8_t ReadUInt8(); u_int16_t ReadUInt16(); u_int32_t ReadUInt24(); u_int32_t ReadUInt32(); u_int64_t ReadUInt64(); float ReadFixed16(); float ReadFixed32(); float ReadFloat(); char* ReadString(); char* ReadCountedString( u_int8_t charSize = 1, bool allowExpandedCount = false); u_int64_t ReadBits(u_int8_t numBits); void FlushReadBits(); u_int32_t ReadMpegLength(); void PeekBytes( u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); void WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); void WriteUInt8(u_int8_t value); void WriteUInt16(u_int16_t value); void WriteUInt24(u_int32_t value); void WriteUInt32(u_int32_t value); void WriteUInt64(u_int64_t value); void WriteFixed16(float value); void WriteFixed32(float value); void WriteFloat(float value); void WriteString(char* string); void WriteCountedString(char* string, u_int8_t charSize = 1, bool allowExpandedCount = false); void WriteBits(u_int64_t bits, u_int8_t numBits); void PadWriteBits(u_int8_t pad = 0); void FlushWriteBits(); void WriteMpegLength(u_int32_t value, bool compact = false); void EnableMemoryBuffer( u_int8_t* pBytes = NULL, u_int64_t numBytes = 0); void DisableMemoryBuffer( u_int8_t** ppBytes = NULL, u_int64_t* pNumBytes = NULL); char GetMode() { return m_mode; } MP4Track* GetTrack(MP4TrackId trackId); void UpdateDuration(MP4Duration duration); MP4Atom* FindAtom(const char* name); MP4Atom* AddChildAtom( const char* parentName, const char* childName); MP4Atom* AddChildAtom( MP4Atom* pParentAtom, const char* childName); MP4Atom* InsertChildAtom( const char* parentName, const char* childName, u_int32_t index); MP4Atom* InsertChildAtom( MP4Atom* pParentAtom, const char* childName, u_int32_t index); MP4Atom* AddDescendantAtoms( const char* ancestorName, const char* childName); MP4Atom* AddDescendantAtoms( MP4Atom* pAncestorAtom, const char* childName); protected: void Open(const char* fmode); #ifdef _WIN32 void Open(const wchar_t* fmode); #endif void ReadFromFile(); void GenerateTracks(); void BeginWrite(); void FinishWrite(); void CacheProperties(); void RewriteMdat(void* pReadFile, void* pWriteFile, Virtual_IO *readIO, Virtual_IO *writeIO); bool ShallHaveIods(); const char* TempFileName(); void Rename(const char* existingFileName, const char* newFileName); void ProtectWriteOperation(char* where); void FindIntegerProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); void FindFloatProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); void FindStringProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); void FindBytesProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); MP4TrackId AddVideoTrackDefault( u_int32_t timeScale, MP4Duration sampleDuration, u_int16_t width, u_int16_t height, const char *videoType); MP4TrackId AddCntlTrackDefault( u_int32_t timeScale, MP4Duration sampleDuration, const char *videoType); void AddTrackToIod(MP4TrackId trackId); void RemoveTrackFromIod(MP4TrackId trackId, bool shallHaveIods = true); void AddTrackToOd(MP4TrackId trackId); void RemoveTrackFromOd(MP4TrackId trackId); void GetTrackReferenceProperties(const char* trefName, MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty); void AddTrackReference(const char* trefName, MP4TrackId refTrackId); u_int32_t FindTrackReference(const char* trefName, MP4TrackId refTrackId); void RemoveTrackReference(const char* trefName, MP4TrackId refTrackId); void AddDataReference(MP4TrackId trackId, const char* url); char* MakeTrackName(MP4TrackId trackId, const char* name); u_int8_t ConvertTrackTypeToStreamType(const char* trackType); void CreateIsmaIodFromFile( MP4TrackId odTrackId, MP4TrackId sceneTrackId, MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes); void CreateESD( MP4DescriptorProperty* pEsProperty, u_int32_t esid, u_int8_t objectType, u_int8_t streamType, u_int32_t bufferSize, u_int32_t bitrate, const u_int8_t* pConfig, u_int32_t configLength, char* url); void CreateIsmaODUpdateCommandFromFileForFile( MP4TrackId odTrackId, MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes); void CreateIsmaODUpdateCommandFromFileForStream( MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes); void CreateIsmaODUpdateCommandForStream( MP4DescriptorProperty* pAudioEsdProperty, MP4DescriptorProperty* pVideoEsdProperty, u_int8_t** ppBytes, u_int64_t* pNumBytes); void CreateIsmaSceneCommand( bool hasAudio, bool hasVideo, u_int8_t** ppBytes, u_int64_t* pNumBytes); protected: char* m_fileName; #ifdef _WIN32 wchar_t* m_fileName_w; #endif void* m_pFile; Virtual_IO *m_virtual_IO; u_int64_t m_orgFileSize; u_int64_t m_fileSize; MP4Atom* m_pRootAtom; MP4Integer32Array m_trakIds; MP4TrackArray m_pTracks; MP4TrackId m_odTrackId; u_int32_t m_verbosity; char m_mode; u_int32_t m_createFlags; bool m_useIsma; // cached properties MP4IntegerProperty* m_pModificationProperty; MP4Integer32Property* m_pTimeScaleProperty; MP4IntegerProperty* m_pDurationProperty; // read/write in memory u_int8_t* m_memoryBuffer; u_int64_t m_memoryBufferPosition; u_int64_t m_memoryBufferSize; // bit read/write buffering u_int8_t m_numReadBits; u_int8_t m_bufReadBits; u_int8_t m_numWriteBits; u_int8_t m_bufWriteBits; #ifndef _WIN32 char m_tempFileName[64]; #else char m_tempFileName[MAX_PATH + 3]; #endif char m_trakName[1024]; char *m_editName; }; #endif /* __MP4_FILE_INCLUDED__ */ faac-1.28/common/mp4v2/mp4file_io.cpp0000644010307701030770000002664211136736372021062 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" // MP4File low level IO support u_int64_t MP4File::GetPosition(FILE* pFile) { if (m_memoryBuffer == NULL) { if (pFile == NULL) { ASSERT(m_pFile); u_int64_t fpos; if (m_virtual_IO->GetPosition(m_pFile, &fpos) != 0) { throw new MP4Error("getting position via Virtual I/O", "MP4GetPosition"); } return fpos; } else { fpos_t fpos; if (fgetpos(pFile, &fpos) < 0) { throw new MP4Error(errno, "MP4GetPosition"); } uint64_t ret; FPOS_TO_VAR(fpos, uint64_t, ret); return ret; } } else { return m_memoryBufferPosition; } } void MP4File::SetPosition(u_int64_t pos, FILE* pFile) { if (m_memoryBuffer == NULL) { if (pFile == NULL) { ASSERT(m_pFile); if (m_virtual_IO->SetPosition(m_pFile, pos) != 0) { throw new MP4Error("setting position via Virtual I/O", "MP4SetPosition"); } } else { fpos_t fpos; VAR_TO_FPOS(fpos, pos); if (fsetpos(pFile, &fpos) < 0) { throw new MP4Error(errno, "MP4SetPosition"); } } } else { if (pos >= m_memoryBufferSize) { // abort(); throw new MP4Error("position out of range", "MP4SetPosition"); } m_memoryBufferPosition = pos; } } u_int64_t MP4File::GetSize() { if (m_mode == 'w') { // we're always positioned at the end of file in write mode // except for short intervals in ReadSample and FinishWrite routines // so we rely on the faster approach of GetPosition() // instead of flushing to disk, and then stat'ing the file m_fileSize = GetPosition(); } // else read mode, fileSize was determined at Open() return m_fileSize; } void MP4File::ReadBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) { // handle degenerate cases if (numBytes == 0) { return; } ASSERT(pBytes); WARNING(m_numReadBits > 0); if (m_memoryBuffer == NULL) { if (pFile == NULL) { ASSERT(m_pFile); if (m_virtual_IO->Read(m_pFile, pBytes, numBytes) != numBytes) { throw new MP4Error("not enough bytes, reached end-of-file", "MP4ReadBytes"); } } else { if (fread(pBytes, 1, numBytes, pFile) != numBytes) { if (feof(pFile)) { throw new MP4Error( "not enough bytes, reached end-of-file", "MP4ReadBytes"); } else { throw new MP4Error(errno, "MP4ReadBytes"); } } } } else { if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) { throw new MP4Error( "not enough bytes, reached end-of-memory", "MP4ReadBytes"); } memcpy(pBytes, &m_memoryBuffer[m_memoryBufferPosition], numBytes); m_memoryBufferPosition += numBytes; } return; } void MP4File::PeekBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) { u_int64_t pos = GetPosition(pFile); ReadBytes(pBytes, numBytes, pFile); SetPosition(pos, pFile); } void MP4File::EnableMemoryBuffer(u_int8_t* pBytes, u_int64_t numBytes) { ASSERT(m_memoryBuffer == NULL); if (pBytes) { m_memoryBuffer = pBytes; m_memoryBufferSize = numBytes; } else { if (numBytes) { m_memoryBufferSize = numBytes; } else { m_memoryBufferSize = 4096; } m_memoryBuffer = (u_int8_t*)MP4Malloc(m_memoryBufferSize); } m_memoryBufferPosition = 0; } void MP4File::DisableMemoryBuffer(u_int8_t** ppBytes, u_int64_t* pNumBytes) { ASSERT(m_memoryBuffer != NULL); if (ppBytes) { *ppBytes = m_memoryBuffer; } if (pNumBytes) { *pNumBytes = m_memoryBufferPosition; } m_memoryBuffer = NULL; m_memoryBufferSize = 0; m_memoryBufferPosition = 0; } void MP4File::WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) { ASSERT(m_numWriteBits == 0 || m_numWriteBits >= 8); if (pBytes == NULL || numBytes == 0) { return; } if (m_memoryBuffer == NULL) { if (pFile == NULL) { ASSERT(m_pFile); if (m_virtual_IO->Write(m_pFile, pBytes, numBytes) != numBytes) { throw new MP4Error("error writing bytes via virtual I/O", "MP4WriteBytes"); } } else { u_int32_t rc = fwrite(pBytes, 1, numBytes, pFile); if (rc != numBytes) { throw new MP4Error(errno, "MP4WriteBytes"); } } } else { if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) { m_memoryBufferSize = 2 * (m_memoryBufferSize + numBytes); m_memoryBuffer = (u_int8_t*) MP4Realloc(m_memoryBuffer, m_memoryBufferSize); } memcpy(&m_memoryBuffer[m_memoryBufferPosition], pBytes, numBytes); m_memoryBufferPosition += numBytes; } } u_int64_t MP4File::ReadUInt(u_int8_t size) { switch (size) { case 1: return ReadUInt8(); case 2: return ReadUInt16(); case 3: return ReadUInt24(); case 4: return ReadUInt32(); case 8: return ReadUInt64(); default: ASSERT(false); return 0; } } #if 0 void MP4File::WriteUInt(u_int64_t value, u_int8_t size) { switch (size) { case 1: WriteUInt8(value); case 2: WriteUInt16(value); case 3: WriteUInt24(value); case 4: WriteUInt32(value); case 8: WriteUInt64(value); default: ASSERT(false); } } #endif u_int8_t MP4File::ReadUInt8() { u_int8_t data; ReadBytes(&data, 1); return data; } void MP4File::WriteUInt8(u_int8_t value) { WriteBytes(&value, 1); } u_int16_t MP4File::ReadUInt16() { u_int8_t data[2]; ReadBytes(&data[0], 2); return ((data[0] << 8) | data[1]); } void MP4File::WriteUInt16(u_int16_t value) { u_int8_t data[2]; data[0] = (value >> 8) & 0xFF; data[1] = value & 0xFF; WriteBytes(data, 2); } u_int32_t MP4File::ReadUInt24() { u_int8_t data[3]; ReadBytes(&data[0], 3); return ((data[0] << 16) | (data[1] << 8) | data[2]); } void MP4File::WriteUInt24(u_int32_t value) { u_int8_t data[3]; data[0] = (value >> 16) & 0xFF; data[1] = (value >> 8) & 0xFF; data[2] = value & 0xFF; WriteBytes(data, 3); } u_int32_t MP4File::ReadUInt32() { u_int8_t data[4]; ReadBytes(&data[0], 4); return ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]); } void MP4File::WriteUInt32(u_int32_t value) { u_int8_t data[4]; data[0] = (value >> 24) & 0xFF; data[1] = (value >> 16) & 0xFF; data[2] = (value >> 8) & 0xFF; data[3] = value & 0xFF; WriteBytes(data, 4); } u_int64_t MP4File::ReadUInt64() { u_int8_t data[8]; u_int64_t result = 0; u_int64_t temp; ReadBytes(&data[0], 8); for (int i = 0; i < 8; i++) { temp = data[i]; result |= temp << ((7 - i) * 8); } return result; } void MP4File::WriteUInt64(u_int64_t value) { u_int8_t data[8]; for (int i = 7; i >= 0; i--) { data[i] = value & 0xFF; value >>= 8; } WriteBytes(data, 8); } float MP4File::ReadFixed16() { u_int8_t iPart = ReadUInt8(); u_int8_t fPart = ReadUInt8(); return iPart + (((float)fPart) / 0x100); } void MP4File::WriteFixed16(float value) { if (value >= 0x100) { throw new MP4Error(ERANGE, "MP4WriteFixed16"); } u_int8_t iPart = (u_int8_t)value; u_int8_t fPart = (u_int8_t)((value - iPart) * 0x100); WriteUInt8(iPart); WriteUInt8(fPart); } float MP4File::ReadFixed32() { u_int16_t iPart = ReadUInt16(); u_int16_t fPart = ReadUInt16(); return iPart + (((float)fPart) / 0x10000); } void MP4File::WriteFixed32(float value) { if (value >= 0x10000) { throw new MP4Error(ERANGE, "MP4WriteFixed32"); } u_int16_t iPart = (u_int16_t)value; u_int16_t fPart = (u_int16_t)((value - iPart) * 0x10000); WriteUInt16(iPart); WriteUInt16(fPart); } float MP4File::ReadFloat() { union { float f; u_int32_t i; } u; u.i = ReadUInt32(); return u.f; } void MP4File::WriteFloat(float value) { union { float f; u_int32_t i; } u; u.f = value; WriteUInt32(u.i); } char* MP4File::ReadString() { u_int32_t length = 0; u_int32_t alloced = 64; char* data = (char*)MP4Malloc(alloced); do { if (length == alloced) { data = (char*)MP4Realloc(data, alloced * 2); if (data == NULL) return NULL; alloced *= 2; } ReadBytes((u_int8_t*)&data[length], 1); length++; } while (data[length - 1] != 0); data = (char*)MP4Realloc(data, length); return data; } void MP4File::WriteString(char* string) { if (string == NULL) { u_int8_t zero = 0; WriteBytes(&zero, 1); } else { WriteBytes((u_int8_t*)string, strlen(string) + 1); } } char* MP4File::ReadCountedString(u_int8_t charSize, bool allowExpandedCount) { u_int32_t charLength; if (allowExpandedCount) { u_int8_t b; uint ix = 0; charLength = 0; do { b = ReadUInt8(); charLength += b; ix++; if (ix > 25) throw new MP4Error(ERANGE, "Counted string too long 25 * 255"); } while (b == 255); } else { charLength = ReadUInt8(); } u_int32_t byteLength = charLength * charSize; char* data = (char*)MP4Malloc(byteLength + 1); if (byteLength > 0) { ReadBytes((u_int8_t*)data, byteLength); } data[byteLength] = '\0'; return data; } void MP4File::WriteCountedString(char* string, u_int8_t charSize, bool allowExpandedCount) { u_int32_t byteLength; if (string) { byteLength = strlen(string); } else { byteLength = 0; } u_int32_t charLength = byteLength / charSize; if (allowExpandedCount) { while (charLength >= 0xFF) { WriteUInt8(0xFF); charLength -= 0xFF; } WriteUInt8(charLength); } else { if (charLength > 255) { throw new MP4Error(ERANGE, "Length is %d", "MP4WriteCountedString", charLength); } WriteUInt8(charLength); } if (byteLength > 0) { WriteBytes((u_int8_t*)string, byteLength); } } u_int64_t MP4File::ReadBits(u_int8_t numBits) { ASSERT(numBits > 0); ASSERT(numBits <= 64); u_int64_t bits = 0; for (u_int8_t i = numBits; i > 0; i--) { if (m_numReadBits == 0) { ReadBytes(&m_bufReadBits, 1); m_numReadBits = 8; } bits = (bits << 1) | ((m_bufReadBits >> (--m_numReadBits)) & 1); } return bits; } void MP4File::FlushReadBits() { // eat any remaining bits in the read buffer m_numReadBits = 0; } void MP4File::WriteBits(u_int64_t bits, u_int8_t numBits) { ASSERT(numBits <= 64); for (u_int8_t i = numBits; i > 0; i--) { m_bufWriteBits |= (((bits >> (i - 1)) & 1) << (8 - ++m_numWriteBits)); if (m_numWriteBits == 8) { FlushWriteBits(); } } } void MP4File::PadWriteBits(u_int8_t pad) { if (m_numWriteBits) { WriteBits(pad ? 0xFF : 0x00, 8 - m_numWriteBits); } } void MP4File::FlushWriteBits() { if (m_numWriteBits > 0) { WriteBytes(&m_bufWriteBits, 1); m_numWriteBits = 0; m_bufWriteBits = 0; } } u_int32_t MP4File::ReadMpegLength() { u_int32_t length = 0; u_int8_t numBytes = 0; u_int8_t b; do { b = ReadUInt8(); length = (length << 7) | (b & 0x7F); numBytes++; } while ((b & 0x80) && numBytes < 4); return length; } void MP4File::WriteMpegLength(u_int32_t value, bool compact) { if (value > 0x0FFFFFFF) { throw new MP4Error(ERANGE, "MP4WriteMpegLength"); } int8_t numBytes; if (compact) { if (value <= 0x7F) { numBytes = 1; } else if (value <= 0x3FFF) { numBytes = 2; } else if (value <= 0x1FFFFF) { numBytes = 3; } else { numBytes = 4; } } else { numBytes = 4; } int8_t i = numBytes; do { i--; u_int8_t b = (value >> (i * 7)) & 0x7F; if (i > 0) { b |= 0x80; } WriteUInt8(b); } while (i > 0); } faac-1.28/common/mp4v2/mp4info.cpp0000644010307701030770000004045211136736372020402 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001-2002. All Rights Reserved. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Bill May wmay@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" static char* PrintAudioInfo( MP4FileHandle mp4File, MP4TrackId trackId) { static const char* mpeg4AudioNames[] = { "MPEG-4 AAC main", "MPEG-4 AAC LC", "MPEG-4 AAC SSR", "MPEG-4 AAC LTP", "MPEG-4 AAC HE", "MPEG-4 AAC Scalable", "MPEG-4 TwinVQ", "MPEG-4 CELP", "MPEG-4 HVXC", NULL, NULL, "MPEG-4 TTSI", "MPEG-4 Main Synthetic", "MPEG-4 Wavetable Syn", "MPEG-4 General MIDI", "MPEG-4 Algo Syn and Audio FX", "MPEG-4 ER AAC LC", NULL, "MPEG-4 ER AAC LTP", "MPEG-4 ER AAC Scalable", "MPEG-4 ER TwinVQ", "MPEG-4 ER BSAC", "MPEG-4 ER ACC LD", "MPEG-4 ER CELP", "MPEG-4 ER HVXC", "MPEG-4 ER HILN", "MPEG-4 ER Parametric", "MPEG-4 SSC", "MPEG-4 PS", "MPEG-4 MPEG Surround", NULL, "MPEG-4 Layer-1", "MPEG-4 Layer-2", "MPEG-4 Layer-3", "MPEG-4 DST", "MPEG-4 Audio Lossless", "MPEG-4 SLS", "MPEG-4 SLS non-core", }; static const u_int8_t mpegAudioTypes[] = { MP4_MPEG2_AAC_MAIN_AUDIO_TYPE, // 0x66 MP4_MPEG2_AAC_LC_AUDIO_TYPE, // 0x67 MP4_MPEG2_AAC_SSR_AUDIO_TYPE, // 0x68 MP4_MPEG2_AUDIO_TYPE, // 0x69 MP4_MPEG1_AUDIO_TYPE, // 0x6B // private types MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE, MP4_VORBIS_AUDIO_TYPE, MP4_ALAW_AUDIO_TYPE, MP4_ULAW_AUDIO_TYPE, MP4_G723_AUDIO_TYPE, MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE, }; static const char* mpegAudioNames[] = { "MPEG-2 AAC Main", "MPEG-2 AAC LC", "MPEG-2 AAC SSR", "MPEG-2 Audio (13818-3)", "MPEG-1 Audio (11172-3)", // private types "PCM16 (little endian)", "Vorbis", "G.711 aLaw", "G.711 uLaw", "G.723.1", "PCM16 (big endian)", }; u_int8_t numMpegAudioTypes = sizeof(mpegAudioTypes) / sizeof(u_int8_t); const char* typeName = "Unknown"; bool foundType = false; u_int8_t type = 0; const char *media_data_name; media_data_name = MP4GetTrackMediaDataName(mp4File, trackId); if (media_data_name == NULL) { typeName = "Unknown - no media data name"; } else if (strcasecmp(media_data_name, "samr") == 0) { typeName = "AMR"; foundType = true; } else if (strcasecmp(media_data_name, "sawb") == 0) { typeName = "AMR-WB"; foundType = true; } else if (strcasecmp(media_data_name, "mp4a") == 0) { type = MP4GetTrackEsdsObjectTypeId(mp4File, trackId); switch (type) { case MP4_INVALID_AUDIO_TYPE: typeName = "AAC from .mov"; foundType = true; break; case MP4_MPEG4_AUDIO_TYPE: { type = MP4GetTrackAudioMpeg4Type(mp4File, trackId); if (type == MP4_MPEG4_INVALID_AUDIO_TYPE || type > NUM_ELEMENTS_IN_ARRAY(mpeg4AudioNames) || mpeg4AudioNames[type - 1] == NULL) { typeName = "MPEG-4 Unknown Profile"; } else { typeName = mpeg4AudioNames[type - 1]; foundType = true; } break; } // fall through default: for (u_int8_t i = 0; i < numMpegAudioTypes; i++) { if (type == mpegAudioTypes[i]) { typeName = mpegAudioNames[i]; foundType = true; break; } } } } else { typeName = media_data_name; foundType = true; } u_int32_t timeScale = MP4GetTrackTimeScale(mp4File, trackId); MP4Duration trackDuration = MP4GetTrackDuration(mp4File, trackId); double msDuration = UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, trackDuration, MP4_MSECS_TIME_SCALE)); u_int32_t avgBitRate = MP4GetTrackBitRate(mp4File, trackId); char *sInfo = (char*)MP4Malloc(256); // type duration avgBitrate samplingFrequency if (foundType) snprintf(sInfo, 256, "%u\taudio\t%s%s, %.3f secs, %u kbps, %u Hz\n", trackId, MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "", typeName, msDuration / 1000.0, (avgBitRate + 500) / 1000, timeScale); else snprintf(sInfo, 256, "%u\taudio\t%s%s(%u), %.3f secs, %u kbps, %u Hz\n", trackId, MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "", typeName, type, msDuration / 1000.0, (avgBitRate + 500) / 1000, timeScale); return sInfo; } static const struct { uint8_t profile; const char *name; } VisualProfileToName[] = { { MPEG4_SP_L1, "MPEG-4 Simple @ L1"}, { MPEG4_SP_L2, "MPEG-4 Simple @ L2" }, { MPEG4_SP_L3, "MPEG-4 Simple @ L3" }, { MPEG4_SP_L0, "MPEG-4 Simple @ L0" }, { MPEG4_SSP_L1, "MPEG-4 Simple Scalable @ L1"}, { MPEG4_SSP_L2, "MPEG-4 Simple Scalable @ L2" }, { MPEG4_CP_L1, "MPEG-4 Core @ L1"}, { MPEG4_CP_L2, "MPEG-4 Core @ L2"}, { MPEG4_MP_L2, "MPEG-4 Main @ L2"}, { MPEG4_MP_L3, "MPEG-4 Main @ L3"}, { MPEG4_MP_L4, "MPEG-4 Main @ L4"}, { MPEG4_NBP_L2, "MPEG-4 N-bit @ L2"}, { MPEG4_STP_L1, "MPEG-4 Scalable Texture @ L1"}, { MPEG4_SFAP_L1, "MPEG-4 Simple Face Anim @ L1"}, { MPEG4_SFAP_L2, "MPEG-4 Simple Face Anim @ L2"}, { MPEG4_SFBAP_L1, "MPEG-4 Simple FBA @ L1"}, { MPEG4_SFBAP_L2, "MPEG-4 Simple FBA @ L2"}, { MPEG4_BATP_L1, "MPEG-4 Basic Anim Text @ L1"}, { MPEG4_BATP_L2, "MPEG-4 Basic Anim Text @ L2"}, { MPEG4_HP_L1, "MPEG-4 Hybrid @ L1"}, { MPEG4_HP_L2, "MPEG-4 Hybrid @ L2"}, { MPEG4_ARTSP_L1, "MPEG-4 Adv RT Simple @ L1"}, { MPEG4_ARTSP_L2, "MPEG-4 Adv RT Simple @ L2"}, { MPEG4_ARTSP_L3, "MPEG-4 Adv RT Simple @ L3"}, { MPEG4_ARTSP_L4, "MPEG-4 Adv RT Simple @ L4"}, { MPEG4_CSP_L1, "MPEG-4 Core Scalable @ L1"}, { MPEG4_CSP_L2, "MPEG-4 Core Scalable @ L2"}, { MPEG4_CSP_L3, "MPEG-4 Core Scalable @ L3"}, { MPEG4_ACEP_L1, "MPEG-4 Adv Coding Efficieny @ L1"}, { MPEG4_ACEP_L2, "MPEG-4 Adv Coding Efficieny @ L2"}, { MPEG4_ACEP_L3, "MPEG-4 Adv Coding Efficieny @ L3"}, { MPEG4_ACEP_L4, "MPEG-4 Adv Coding Efficieny @ L4"}, { MPEG4_ACP_L1, "MPEG-4 Adv Core Profile @ L1"}, { MPEG4_ACP_L2, "MPEG-4 Adv Core Profile @ L2"}, { MPEG4_AST_L1, "MPEG-4 Adv Scalable Texture @ L1"}, { MPEG4_AST_L2, "MPEG-4 Adv Scalable Texture @ L2"}, { MPEG4_AST_L3, "MPEG-4 Adv Scalable Texture @ L3"}, { MPEG4_S_STUDIO_P_L1, "MPEG-4 Simple Studio @ L1"}, { MPEG4_S_STUDIO_P_L2, "MPEG-4 Simple Studio @ L2"}, { MPEG4_S_STUDIO_P_L3, "MPEG-4 Simple Studio @ L3"}, { MPEG4_S_STUDIO_P_L4, "MPEG-4 Simple Studio @ L4"}, { MPEG4_C_STUDIO_P_L1, "MPEG-4 Core Studio @ L1"}, { MPEG4_C_STUDIO_P_L2, "MPEG-4 Core Studio @ L2"}, { MPEG4_C_STUDIO_P_L3, "MPEG-4 Core Studio @ L3"}, { MPEG4_C_STUDIO_P_L4, "MPEG-4 Core Studio @ L4"}, { MPEG4_ASP_L0, "MPEG-4 Adv Simple@L0"}, { MPEG4_ASP_L1, "MPEG-4 Adv Simple@L1"}, { MPEG4_ASP_L2, "MPEG-4 Adv Simple@L2"}, { MPEG4_ASP_L3, "MPEG-4 Adv Simple@L3"}, { MPEG4_ASP_L4, "MPEG-4 Adv Simple@L4"}, { MPEG4_ASP_L5, "MPEG-4 Adv Simple@L5"}, { MPEG4_ASP_L3B, "MPEG-4 Adv Simple@L3b"}, { MPEG4_FGSP_L0, "MPEG-4 FGS @ L0" }, { MPEG4_FGSP_L1, "MPEG-4 FGS @ L1" }, { MPEG4_FGSP_L2, "MPEG-4 FGS @ L2" }, { MPEG4_FGSP_L3, "MPEG-4 FGS @ L3" }, { MPEG4_FGSP_L4, "MPEG-4 FGS @ L4" }, { MPEG4_FGSP_L5, "MPEG-4 FGS @ L5" } }; static const char *Mpeg4VisualProfileName (uint8_t visual_profile) { size_t size = sizeof(VisualProfileToName) / sizeof(*VisualProfileToName); for (size_t ix = 0; ix < size; ix++) { if (visual_profile == VisualProfileToName[ix].profile) { return (VisualProfileToName[ix].name); } } return (NULL); } static char* PrintVideoInfo( MP4FileHandle mp4File, MP4TrackId trackId) { static const u_int8_t mpegVideoTypes[] = { MP4_MPEG2_SIMPLE_VIDEO_TYPE, // 0x60 MP4_MPEG2_MAIN_VIDEO_TYPE, // 0x61 MP4_MPEG2_SNR_VIDEO_TYPE, // 0x62 MP4_MPEG2_SPATIAL_VIDEO_TYPE, // 0x63 MP4_MPEG2_HIGH_VIDEO_TYPE, // 0x64 MP4_MPEG2_442_VIDEO_TYPE, // 0x65 MP4_MPEG1_VIDEO_TYPE, // 0x6A MP4_JPEG_VIDEO_TYPE, // 0x6C MP4_YUV12_VIDEO_TYPE, MP4_H263_VIDEO_TYPE, MP4_H261_VIDEO_TYPE, }; static const char* mpegVideoNames[] = { "MPEG-2 Simple", "MPEG-2 Main", "MPEG-2 SNR", "MPEG-2 Spatial", "MPEG-2 High", "MPEG-2 4:2:2", "MPEG-1", "JPEG", "YUV12", "H.263", "H.261", }; u_int8_t numMpegVideoTypes = sizeof(mpegVideoTypes) / sizeof(u_int8_t); bool foundTypeName = false; const char* typeName = "Unknown"; const char *media_data_name; char originalFormat[8]; char oformatbuffer[32]; originalFormat[0] = 0; *oformatbuffer = 0; uint8_t type = 0; media_data_name = MP4GetTrackMediaDataName(mp4File, trackId); // encv 264b if (strcasecmp(media_data_name, "encv") == 0) { if (MP4GetTrackMediaDataOriginalFormat(mp4File, trackId, originalFormat, sizeof(originalFormat)) == false) media_data_name = NULL; } char typebuffer[80]; if (media_data_name == NULL) { typeName = "Unknown - no media data name"; foundTypeName = true; } else if ((strcasecmp(media_data_name, "avc1") == 0) || (strcasecmp(originalFormat, "264b") == 0)) { // avc uint8_t profile, level; char profileb[20], levelb[20]; if (MP4GetTrackH264ProfileLevel(mp4File, trackId, &profile, &level)) { if (profile == 66) { strcpy(profileb, "Baseline"); } else if (profile == 77) { strcpy(profileb, "Main"); } else if (profile == 88) { strcpy(profileb, "Extended"); } else if (profile == 100) { strcpy(profileb, "High"); } else if (profile == 110) { strcpy(profileb, "High 10"); } else if (profile == 122) { strcpy(profileb, "High 4:2:2"); } else if (profile == 144) { strcpy(profileb, "High 4:4:4"); } else { snprintf(profileb, 20, "Unknown Profile %x", profile); } switch (level) { case 10: case 20: case 30: case 40: case 50: snprintf(levelb, 20, "%u", level / 10); break; case 11: case 12: case 13: case 21: case 22: case 31: case 32: case 41: case 42: case 51: snprintf(levelb, 20, "%u.%u", level / 10, level % 10); break; default: snprintf(levelb, 20, "unknown level %x", level); break; } if (originalFormat != NULL && originalFormat[0] != '\0') snprintf(oformatbuffer, 32, "(%s) ", originalFormat); snprintf(typebuffer, sizeof(typebuffer), "H264 %s%s@%s", oformatbuffer, profileb, levelb); typeName = typebuffer; } else { typeName = "H.264 - profile/level error"; } foundTypeName = true; } else if (strcasecmp(media_data_name, "s263") == 0) { // 3gp h.263 typeName = "H.263"; foundTypeName = true; } else if ((strcasecmp(media_data_name, "mp4v") == 0) || (strcasecmp(media_data_name, "encv") == 0)) { // note encv might needs it's own field eventually. type = MP4GetTrackEsdsObjectTypeId(mp4File, trackId); if (type == MP4_MPEG4_VIDEO_TYPE) { type = MP4GetVideoProfileLevel(mp4File, trackId); typeName = Mpeg4VisualProfileName(type); if (typeName == NULL) { typeName = "MPEG-4 Unknown Profile"; } else { foundTypeName = true; } } else { for (u_int8_t i = 0; i < numMpegVideoTypes; i++) { if (type == mpegVideoTypes[i]) { typeName = mpegVideoNames[i]; foundTypeName = true; break; } } } } else { typeName = media_data_name; foundTypeName = true; // we don't have a type value to display } MP4Duration trackDuration = MP4GetTrackDuration(mp4File, trackId); double msDuration = UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, trackDuration, MP4_MSECS_TIME_SCALE)); u_int32_t avgBitRate = MP4GetTrackBitRate(mp4File, trackId); // Note not all mp4 implementations set width and height correctly // The real answer can be buried inside the ES configuration info u_int16_t width = MP4GetTrackVideoWidth(mp4File, trackId); u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId); double fps = MP4GetTrackVideoFrameRate(mp4File, trackId); char *sInfo = (char*)MP4Malloc(256); // type duration avgBitrate frameSize frameRate if (foundTypeName) { sprintf(sInfo, "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %f fps\n", trackId, MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "encv - " : "", typeName, msDuration / 1000.0, (avgBitRate + 500) / 1000, width, height, fps ); } else { sprintf(sInfo, "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %f fps\n", trackId, typeName, type, msDuration / 1000.0, (avgBitRate + 500) / 1000, width, height, fps ); } return sInfo; } static char* PrintCntlInfo( MP4FileHandle mp4File, MP4TrackId trackId) { const char *media_data_name = MP4GetTrackMediaDataName(mp4File, trackId); const char *typeName = "Unknown"; if (media_data_name == NULL) { typeName = "Unknown - no media data name"; } else if (strcasecmp(media_data_name, "href") == 0) { typeName = "ISMA Href"; } else { typeName = media_data_name; } MP4Duration trackDuration = MP4GetTrackDuration(mp4File, trackId); double msDuration = UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, trackDuration, MP4_MSECS_TIME_SCALE)); char *sInfo = (char *)MP4Malloc(256); snprintf(sInfo, 256, "%u\tcontrol\t%s, %.3f secs\n", trackId, typeName, msDuration / 1000.0); return sInfo; } static char* PrintHintInfo( MP4FileHandle mp4File, MP4TrackId trackId) { MP4TrackId referenceTrackId = MP4GetHintTrackReferenceTrackId(mp4File, trackId); char* payloadName = NULL; if (!MP4GetHintTrackRtpPayload(mp4File, trackId, &payloadName)) return NULL; char *sInfo = (char*)MP4Malloc(256); snprintf(sInfo, 256, "%u\thint\tPayload %s for track %u\n", trackId, payloadName, referenceTrackId); free(payloadName); return sInfo; } static char* PrintTrackInfo( MP4FileHandle mp4File, MP4TrackId trackId) { char* trackInfo = NULL; const char* trackType = MP4GetTrackType(mp4File, trackId); if (trackType == NULL) return NULL; if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) { trackInfo = PrintAudioInfo(mp4File, trackId); } else if (!strcmp(trackType, MP4_VIDEO_TRACK_TYPE)) { trackInfo = PrintVideoInfo(mp4File, trackId); } else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) { trackInfo = PrintHintInfo(mp4File, trackId); } else if (strcmp(trackType, MP4_CNTL_TRACK_TYPE) == 0) { trackInfo = PrintCntlInfo(mp4File, trackId); } else { trackInfo = (char*)MP4Malloc(256); if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) { snprintf(trackInfo, 256, "%u\tod\tObject Descriptors\n", trackId); } else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) { snprintf(trackInfo, 256, "%u\tscene\tBIFS\n", trackId); } else { snprintf(trackInfo, 256, "%u\t%s\n", trackId, trackType); } } return trackInfo; } extern "C" char* MP4Info( MP4FileHandle mp4File, MP4TrackId trackId) { char* info = NULL; if (MP4_IS_VALID_FILE_HANDLE(mp4File)) { try { if (trackId == MP4_INVALID_TRACK_ID) { uint buflen = 4 * 1024; info = (char*)MP4Calloc(buflen); buflen -= snprintf(info, buflen, "Track\tType\tInfo\n"); u_int32_t numTracks = MP4GetNumberOfTracks(mp4File); for (u_int32_t i = 0; i < numTracks; i++) { trackId = MP4FindTrackId(mp4File, i); char* trackInfo = PrintTrackInfo(mp4File, trackId); strncat(info, trackInfo, buflen); uint newlen = strlen(trackInfo); if (newlen > buflen) buflen = 0; else buflen -= newlen; MP4Free(trackInfo); } } else { info = PrintTrackInfo(mp4File, trackId); } } catch (MP4Error* e) { delete e; } } return info; } extern "C" char* MP4FileInfo( const char* fileName, MP4TrackId trackId) { MP4FileHandle mp4File = MP4Read(fileName); if (!mp4File) { return NULL; } char* info = MP4Info(mp4File, trackId); MP4Close(mp4File); return info; // caller should free this } faac-1.28/common/mp4v2/mp4meta.cpp0000644010307701030770000006166211136736372020403 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * M. Bakker mbakker at nero.com * * Apple iTunes Metadata handling */ /** The iTunes tagging seems to support any tag field name but there are some predefined fields, also known from the QuickTime format predefined fields (the ones I know of until now): - nam : Name of the song/movie (string) - ART : Name of the artist/performer (string) - aART : Album artist - wrt : Name of the writer (string) - alb : Name of the album (string) - day : Year (4 bytes, e.g. "2003") (string) - too : Tool(s) used to create the file (string) - cmt : Comment (string) - gen : Custom genre (string) - grp : Grouping (string) - trkn : Tracknumber (8 byte string) 16 bit: empty 16 bit: tracknumber 16 bit: total tracks on album 16 bit: empty - disk : Disknumber (8 byte string) 16 bit: empty 16 bit: disknumber 16 bit: total number of disks 16 bit: empty - gnre : Genre (16 bit genre) (ID3v1 index + 1) - cpil : Part of a compilation (1 byte, 1 or 0) - tmpo : Tempo in BPM (16 bit) - covr : Cover art (xx bytes binary data) - ---- : Free form metadata, can have any name and any data - pgap : gapless - 8 bit boolean - apID : purchaser name. - cprt : copyright - purd : purchase date. **/ #include "mp4common.h" bool MP4File::GetMetadataByIndex(u_int32_t index, char** ppName, u_int8_t** ppValue, u_int32_t* pValueSize) { char s[256]; snprintf(s, 256, "moov.udta.meta.ilst.*[%u].data.metadata", index); GetBytesProperty(s, ppValue, pValueSize); snprintf(s, 256, "moov.udta.meta.ilst.*[%u]", index); MP4Atom* pParent = m_pRootAtom->FindAtom(s); if (pParent == NULL) return false; /* check for free form tagfield */ if (memcmp(*ppName, "----", 4) == 0) { u_int8_t* pV; u_int32_t VSize = 0; char *pN; snprintf(s, 256, "moov.udta.meta.ilst.*[%u].name.metadata", index); GetBytesProperty(s, &pV, &VSize); pN = (char*)malloc((VSize+1)*sizeof(char)); if (pN != NULL) { memset(pN, 0, (VSize+1)*sizeof(char)); memcpy(pN, pV, VSize*sizeof(char)); } free(pV); *ppName = pN; } else { *ppName = strdup(pParent->GetType()); } return true; } bool MP4File::CreateMetadataAtom(const char* name) { char s[256]; char t[256]; snprintf(t, 256, "udta.meta.ilst.%s.data", name); snprintf(s, 256, "moov.udta.meta.ilst.%s.data", name); (void)AddDescendantAtoms("moov", t); MP4Atom *pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) return false; /* some fields need special flags set */ if ((uint8_t)name[0] == 0251 || ATOMID(name) == ATOMID("aART")) { pMetaAtom->SetFlags(0x1); } else if ((memcmp(name, "cpil", 4) == 0) || (memcmp(name, "tmpo", 4) == 0)) { pMetaAtom->SetFlags(0x15); } MP4Atom *pHdlrAtom = m_pRootAtom->FindAtom("moov.udta.meta.hdlr"); MP4StringProperty *pStringProperty = NULL; MP4BytesProperty *pBytesProperty = NULL; ASSERT(pHdlrAtom); ASSERT(pHdlrAtom->FindProperty("hdlr.handlerType", (MP4Property**)&pStringProperty)); ASSERT(pStringProperty); pStringProperty->SetValue("mdir"); u_int8_t val[12]; memset(val, 0, 12*sizeof(u_int8_t)); val[0] = 0x61; val[1] = 0x70; val[2] = 0x70; val[3] = 0x6c; ASSERT(pHdlrAtom->FindProperty("hdlr.reserved2", (MP4Property**)&pBytesProperty)); ASSERT(pBytesProperty); pBytesProperty->SetReadOnly(false); pBytesProperty->SetValue(val, 12); pBytesProperty->SetReadOnly(true); return true; } bool MP4File::DeleteMetadataAtom(const char* name, bool try_udta) { MP4Atom *pMetaAtom = NULL; char s[256]; snprintf(s, 256, "moov.udta.meta.ilst.%s", name); pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL && try_udta) { snprintf(s, 256, "moov.udta.%s", name); pMetaAtom = m_pRootAtom->FindAtom(s); } /* if it exists, delete it */ if (pMetaAtom) { MP4Atom *pParent = pMetaAtom->GetParentAtom(); pParent->DeleteChildAtom(pMetaAtom); delete pMetaAtom; return true; } return false; } bool MP4File::SetMetadataString (const char *atom, const char *value) { char atomstring[40]; MP4Atom *pMetaAtom; MP4BytesProperty *pMetadataProperty = NULL; snprintf(atomstring, 40, "moov.udta.meta.ilst.%s.data", atom); pMetaAtom = m_pRootAtom->FindAtom(atomstring); if (!pMetaAtom) { if (!CreateMetadataAtom(atom)) return false; pMetaAtom = m_pRootAtom->FindAtom(atomstring); if (pMetaAtom == NULL) return false; } ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); return true; } bool MP4File::GetMetadataString (const char *atom, char **value, bool try_udta) { unsigned char *val = NULL; u_int32_t valSize = 0; char atomstring[60]; snprintf(atomstring, 60, "moov.udta.meta.ilst.%s.data.metadata", atom); *value = NULL; if (try_udta == false) { GetBytesProperty(atomstring, (u_int8_t**)&val, &valSize); } else { bool got_it = false; try { GetBytesProperty(atomstring, (u_int8_t**)&val, &valSize); got_it = true; } catch (MP4Error* e) { delete e; } if (got_it == false) { snprintf(atomstring, 60, "moov.udta.%s.metadata", atom); GetBytesProperty(atomstring, (u_int8_t**)&val, &valSize); } } if (valSize > 0) { *value = (char*)malloc((valSize+1)*sizeof(char)); if (*value == NULL) { free(val); return false; } memcpy(*value, val, valSize*sizeof(unsigned char)); free(val); (*value)[valSize] = '\0'; return true; } return false; } bool MP4File::SetMetadataTrack(u_int16_t track, u_int16_t totalTracks) { unsigned char t[9]; const char *s = "moov.udta.meta.ilst.trkn.data"; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("trkn")) return false; pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL) return false; } memset(t, 0, 9*sizeof(unsigned char)); t[2] = (unsigned char)(track>>8)&0xFF; t[3] = (unsigned char)(track)&0xFF; t[4] = (unsigned char)(totalTracks>>8)&0xFF; t[5] = (unsigned char)(totalTracks)&0xFF; ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)t, 8); return true; } bool MP4File::GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks) { unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.trkn.data.metadata"; *track = 0; *totalTracks = 0; GetBytesProperty(s, (u_int8_t**)&val, &valSize); if (valSize == 8) { *track = (u_int16_t)(val[3]); *track += (u_int16_t)(val[2]<<8); *totalTracks = (u_int16_t)(val[5]); *totalTracks += (u_int16_t)(val[4]<<8); CHECK_AND_FREE(val); return true; } CHECK_AND_FREE(val); return false; } bool MP4File::SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks) { unsigned char t[7]; const char *s = "moov.udta.meta.ilst.disk.data"; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("disk")) return false; pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL) return false; } memset(t, 0, 7*sizeof(unsigned char)); t[2] = (unsigned char)(disk>>8)&0xFF; t[3] = (unsigned char)(disk)&0xFF; t[4] = (unsigned char)(totalDisks>>8)&0xFF; t[5] = (unsigned char)(totalDisks)&0xFF; ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)t, 6); return true; } bool MP4File::GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks) { unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.disk.data.metadata"; *disk = 0; *totalDisks = 0; GetBytesProperty(s, (u_int8_t**)&val, &valSize); if (valSize == 6 || valSize == 8) { *disk = (u_int16_t)(val[3]); *disk += (u_int16_t)(val[2]<<8); *totalDisks = (u_int16_t)(val[5]); *totalDisks += (u_int16_t)(val[4]<<8); free(val); return true; } CHECK_AND_FREE(val); return true; } static const char* ID3v1GenreList[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror", "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "SynthPop", }; void GenreToString(char** GenreStr, const int genre) { if (genre > 0 && genre <= (int)(sizeof(ID3v1GenreList)/sizeof(*ID3v1GenreList))) { uint len = strlen(ID3v1GenreList[genre-1])+1; *GenreStr = (char*)malloc(len); if (*GenreStr == NULL) return; // no need for strncpy; enough was malloced strcpy(*GenreStr, ID3v1GenreList[genre-1]); return; } *GenreStr = (char*)malloc(2*sizeof(char)); if (*GenreStr == NULL) return; memset(*GenreStr, 0, 2*sizeof(char)); return; } int StringToGenre(const char* GenreStr) { unsigned int i; for (i = 0; i < sizeof(ID3v1GenreList)/sizeof(*ID3v1GenreList); i++) { if (strcasecmp(GenreStr, ID3v1GenreList[i]) == 0) return i+1; } return 0; } bool MP4File::SetMetadataGenre(const char* value) { u_int16_t genreIndex = 0; unsigned char t[3]; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; genreIndex = StringToGenre(value); const char *s = "moov.udta.meta.ilst.gnre.data"; const char *sroot = "moov.udta.meta.ilst.gnre"; const char *s2 = "moov.udta.meta.ilst.\251gen.data"; const char *s2root = "moov.udta.meta.ilst.\251gen"; if (genreIndex != 0) { pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("gnre")) return false; pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL) return false; } memset(t, 0, 3*sizeof(unsigned char)); t[0] = (unsigned char)(genreIndex>>8)&0xFF; t[1] = (unsigned char)(genreIndex)&0xFF; ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)t, 2); // remove other style of genre atom, if this one is added pMetaAtom = m_pRootAtom->FindAtom(s2root); if (pMetaAtom != NULL) { MP4Atom *pParent = pMetaAtom->GetParentAtom(); if (pParent != NULL) { pParent->DeleteChildAtom(pMetaAtom); delete pMetaAtom; } } (void)DeleteMetadataAtom( "\251gen" ); return true; } else { pMetaAtom = m_pRootAtom->FindAtom(s2); if (!pMetaAtom) { if (!CreateMetadataAtom("\251gen")) return false; pMetaAtom = m_pRootAtom->FindAtom(s2); } ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); // remove other gnre atom if this one is entered pMetaAtom = m_pRootAtom->FindAtom(sroot); if (pMetaAtom != NULL) { MP4Atom *pParent = pMetaAtom->GetParentAtom(); pParent->DeleteChildAtom(pMetaAtom); delete pMetaAtom; } return true; } return false; } bool MP4File::GetMetadataGenre(char** value) { u_int16_t genreIndex = 0; unsigned char *val = NULL; u_int32_t valSize = 0; const char *t = "moov.udta.meta.ilst.gnre"; const char *s = "moov.udta.meta.ilst.gnre.data.metadata"; *value = NULL; MP4Atom *gnre = FindAtom(t); if (gnre) { GetBytesProperty(s, (u_int8_t**)&val, &valSize); if (valSize != 2) { CHECK_AND_FREE(val); return false; } genreIndex = (u_int16_t)(val[1]); genreIndex += (u_int16_t)(val[0]<<8); GenreToString(value, genreIndex); (void)DeleteMetadataAtom( "gnre" ); free(val); return true; } else { const char *s2 = "moov.udta.meta.ilst.\251gen.data.metadata"; val = NULL; valSize = 0; GetBytesProperty(s2, (u_int8_t**)&val, &valSize); if (valSize > 0) { *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); if (*value != NULL) { memset(*value, 0, (valSize+1)*sizeof(unsigned char)); memcpy(*value, val, valSize*sizeof(unsigned char)); } free(val); return true; } else { CHECK_AND_FREE(val); } } return false; } bool MP4File::DeleteMetadataGenre() { bool val1 = DeleteMetadataAtom("\251gen"); bool val2 = DeleteMetadataAtom("gnre"); return val1 || val2; } bool MP4File::SetMetadataTempo(u_int16_t tempo) { unsigned char t[3]; const char *s = "moov.udta.meta.ilst.tmpo.data"; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("tmpo")) return false; pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL) return false; } memset(t, 0, 3*sizeof(unsigned char)); t[0] = (unsigned char)(tempo>>8)&0xFF; t[1] = (unsigned char)(tempo)&0xFF; ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)t, 2); return true; } bool MP4File::GetMetadataTempo(u_int16_t* tempo) { unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.tmpo.data.metadata"; *tempo = 0; GetBytesProperty(s, (u_int8_t**)&val, &valSize); if (valSize != 2) { CHECK_AND_FREE(val); return false; } *tempo = (u_int16_t)(val[1]); *tempo += (u_int16_t)(val[0]<<8); free(val); return true; } bool MP4File::SetMetadataUint8 (const char *atom, uint8_t value) { char atompath[36]; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; snprintf(atompath, 36, "moov.udta.meta.ilst.%s.data", atom); pMetaAtom = m_pRootAtom->FindAtom(atompath); if (pMetaAtom == NULL) { if (!CreateMetadataAtom(atom)) return false; pMetaAtom = m_pRootAtom->FindAtom(atompath); if (pMetaAtom == NULL) return false; } ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue(&value, 1); return true; } bool MP4File::GetMetadataUint8(const char *atom, u_int8_t* retvalue) { unsigned char *val = NULL; u_int32_t valSize = 0; char atompath[80]; snprintf(atompath, 80, "moov.udta.meta.ilst.%s.data.metadata", atom); *retvalue = 0; GetBytesProperty(atompath, (u_int8_t**)&val, &valSize); if (valSize != 1) { CHECK_AND_FREE(val); return false; } *retvalue = val[0]; free(val); return true; } bool MP4File::SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size) { const char *s = "moov.udta.meta.ilst.covr.data"; MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("covr")) return false; pMetaAtom = m_pRootAtom->FindAtom(s); if (pMetaAtom == NULL) return false; } ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue(coverArt, size); return true; } bool MP4File::GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t *size, uint32_t index) { char buffer[256]; if (size == NULL || coverArt == NULL) return false; if (index > 0 && index > GetMetadataCoverArtCount()) return false; snprintf(buffer, 256, "moov.udta.meta.ilst.covr.data[%d].metadata", index); *coverArt = NULL; *size = 0; GetBytesProperty(buffer, coverArt, size); if (size == 0) return false; return true; } u_int32_t MP4File::GetMetadataCoverArtCount (void) { MP4Atom *pMetaAtom = m_pRootAtom->FindAtom("moov.udta.meta.ilst.covr"); if (!pMetaAtom) return 0; return pMetaAtom->GetNumberOfChildAtoms(); } bool MP4File::SetMetadataFreeForm (const char *name, const u_int8_t* pValue, u_int32_t valueSize, const char *owner) { MP4Atom *pMetaAtom = NULL; MP4BytesProperty *pMetadataProperty = NULL; char s[256]; int i = 0; size_t nameLen = strlen(name); size_t ownerLen = owner != NULL ? strlen(owner) : 0; while (1) { snprintf(s, 256, "moov.udta.meta.ilst.----[%u].name", i); MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); if (!pTagAtom) break; snprintf(s, 256, "moov.udta.meta.ilst.----[%u].mean", i); MP4Atom *pMeanAtom = m_pRootAtom->FindAtom(s); if (pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { u_int8_t* pV; u_int32_t VSize = 0; pMetadataProperty->GetValue(&pV, &VSize); if (VSize == nameLen && memcmp(pV, name, VSize) == 0) { u_int8_t* pOwner=0; u_int32_t ownerSize = 0; if (pMeanAtom && pMeanAtom->FindProperty("mean.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { pMetadataProperty->GetValue(&pOwner, &ownerSize); } if (owner == NULL|| (pOwner && ownerLen == ownerSize && memcmp(owner, pOwner, ownerSize))) { snprintf(s, 256, "moov.udta.meta.ilst.----[%u].data.metadata", i); SetBytesProperty(s, pValue, valueSize); CHECK_AND_FREE(pV); CHECK_AND_FREE(pOwner); return true; } CHECK_AND_FREE(pOwner); } CHECK_AND_FREE(pV); } i++; } /* doesn't exist yet, create it */ char t[256]; snprintf(t, 256, "udta.meta.ilst.----[%u]", i); snprintf(s, 256, "moov.udta.meta.ilst.----[%u].data", i); (void)AddDescendantAtoms("moov", t); pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) return false; pMetaAtom->SetFlags(0x1); MP4Atom *pHdlrAtom = m_pRootAtom->FindAtom("moov.udta.meta.hdlr"); MP4StringProperty *pStringProperty = NULL; MP4BytesProperty *pBytesProperty = NULL; ASSERT(pHdlrAtom); ASSERT(pHdlrAtom->FindProperty("hdlr.handlerType", (MP4Property**)&pStringProperty)); ASSERT(pStringProperty); pStringProperty->SetValue("mdir"); u_int8_t val[12]; memset(val, 0, 12*sizeof(u_int8_t)); val[0] = 0x61; val[1] = 0x70; val[2] = 0x70; val[3] = 0x6c; ASSERT(pHdlrAtom->FindProperty("hdlr.reserved2", (MP4Property**)&pBytesProperty)); ASSERT(pBytesProperty); pBytesProperty->SetReadOnly(false); pBytesProperty->SetValue(val, 12); pBytesProperty->SetReadOnly(true); pMetaAtom = m_pRootAtom->FindAtom(s); ASSERT(pMetaAtom); ASSERT(pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue(pValue, valueSize); snprintf(s, 256, "moov.udta.meta.ilst.----[%u].name", i); pMetaAtom = m_pRootAtom->FindAtom(s); ASSERT(pMetaAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); pMetadataProperty->SetValue((const u_int8_t*)name, strlen(name)); snprintf(s, 256, "moov.udta.meta.ilst.----[%u].mean", i); pMetaAtom = m_pRootAtom->FindAtom(s); ASSERT(pMetaAtom->FindProperty("mean.metadata", (MP4Property**)&pMetadataProperty)); ASSERT(pMetadataProperty); if (!owner || !*owner) pMetadataProperty->SetValue((u_int8_t*)"com.apple.iTunes", 16); /* com.apple.iTunes is the default*/ else pMetadataProperty->SetValue((const u_int8_t*)owner, strlen((const char *)owner)); return true; } bool MP4File::GetMetadataFreeForm(const char *name, u_int8_t** ppValue, u_int32_t *pValueSize, const char *owner) { char s[256]; int i = 0; *ppValue = NULL; *pValueSize = 0; size_t nameLen = strlen(name); size_t ownerLen = owner?strlen(owner):0; while (1) { MP4BytesProperty *pMetadataProperty; snprintf(s, 256,"moov.udta.meta.ilst.----[%u].name", i); MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); snprintf(s, 256,"moov.udta.meta.ilst.----[%u].mean", i); MP4Atom *pMeanAtom = m_pRootAtom->FindAtom(s); if (!pTagAtom) return false; if (pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { u_int8_t* pV; u_int32_t VSize = 0; pMetadataProperty->GetValue(&pV, &VSize); if (VSize == nameLen && memcmp(pV, name, VSize) == 0) { u_int8_t* pOwner=0; u_int32_t ownerSize = 0; if (pMeanAtom && pMeanAtom->FindProperty("mean.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { pMetadataProperty->GetValue(&pOwner, &ownerSize); } if (!owner || (pOwner && ownerLen == ownerSize && memcmp(owner, pOwner, ownerSize))) { snprintf(s, 256, "moov.udta.meta.ilst.----[%u].data.metadata", i); GetBytesProperty(s, ppValue, pValueSize); CHECK_AND_FREE(pV); CHECK_AND_FREE(pOwner); return true; } CHECK_AND_FREE(pOwner); } CHECK_AND_FREE(pV); } i++; } } bool MP4File::DeleteMetadataFreeForm(const char *name, const char *owner) { char s[256]; int i = 0; size_t nameLen = strlen(name); size_t ownerLen = owner?strlen(owner):0; while (1) { MP4BytesProperty *pMetadataProperty; snprintf(s, 256, "moov.udta.meta.ilst.----[%u].name", i); MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); snprintf(s, 256,"moov.udta.meta.ilst.----[%u].mean", i); MP4Atom *pMeanAtom = m_pRootAtom->FindAtom(s); if (!pTagAtom) return false; if (pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { u_int8_t* pV; u_int32_t VSize = 0; pMetadataProperty->GetValue(&pV, &VSize); if (VSize != 0) { if (VSize == nameLen && memcmp(pV, name, VSize) == 0) { u_int8_t* pOwner=0; u_int32_t ownerSize = 0; if (pMeanAtom && pMeanAtom->FindProperty("mean.metadata", (MP4Property**)&pMetadataProperty) && pMetadataProperty) { pMetadataProperty->GetValue(&pOwner, &ownerSize); } if (!owner || (pOwner && ownerLen == ownerSize && memcmp(owner, pOwner, ownerSize))) { snprintf(s, 256, "----[%u]", i); CHECK_AND_FREE(pOwner); CHECK_AND_FREE(pV); return DeleteMetadataAtom(s); } CHECK_AND_FREE(pOwner); } } CHECK_AND_FREE(pV); } i++; } } bool MP4File::MetadataDelete() { MP4Atom *pMetaAtom = NULL; char s[256]; snprintf(s, 256, "moov.udta.meta"); pMetaAtom = m_pRootAtom->FindAtom(s); /* if it exists, delete it */ if (pMetaAtom) { MP4Atom *pParent = pMetaAtom->GetParentAtom(); pParent->DeleteChildAtom(pMetaAtom); delete pMetaAtom; return true; } return false; } faac-1.28/common/mp4v2/mp4property.cpp0000644010307701030770000005200511136736372021330 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4Property::MP4Property(const char* name) { m_name = name; m_pParentAtom = NULL; m_readOnly = false; m_implicit = false; } bool MP4Property::FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex) { if (name == NULL) { return false; } if (!strcasecmp(m_name, name)) { if (m_pParentAtom) { VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), printf("FindProperty: matched %s\n", name)); } *ppProperty = this; return true; } return false; } // Integer Property u_int64_t MP4IntegerProperty::GetValue(u_int32_t index) { switch (this->GetType()) { case Integer8Property: return ((MP4Integer8Property*)this)->GetValue(index); case Integer16Property: return ((MP4Integer16Property*)this)->GetValue(index); case Integer24Property: return ((MP4Integer24Property*)this)->GetValue(index); case Integer32Property: return ((MP4Integer32Property*)this)->GetValue(index); case Integer64Property: return ((MP4Integer64Property*)this)->GetValue(index); default: ASSERT(FALSE); } return (0); } void MP4IntegerProperty::SetValue(u_int64_t value, u_int32_t index) { switch (this->GetType()) { case Integer8Property: ((MP4Integer8Property*)this)->SetValue(value, index); break; case Integer16Property: ((MP4Integer16Property*)this)->SetValue(value, index); break; case Integer24Property: ((MP4Integer24Property*)this)->SetValue(value, index); break; case Integer32Property: ((MP4Integer32Property*)this)->SetValue(value, index); break; case Integer64Property: ((MP4Integer64Property*)this)->SetValue(value, index); break; default: ASSERT(FALSE); } } void MP4IntegerProperty::InsertValue(u_int64_t value, u_int32_t index) { switch (this->GetType()) { case Integer8Property: ((MP4Integer8Property*)this)->InsertValue(value, index); break; case Integer16Property: ((MP4Integer16Property*)this)->InsertValue(value, index); break; case Integer24Property: ((MP4Integer24Property*)this)->InsertValue(value, index); break; case Integer32Property: ((MP4Integer32Property*)this)->InsertValue(value, index); break; case Integer64Property: ((MP4Integer64Property*)this)->InsertValue(value, index); break; default: ASSERT(FALSE); } } void MP4IntegerProperty::DeleteValue(u_int32_t index) { switch (this->GetType()) { case Integer8Property: ((MP4Integer8Property*)this)->DeleteValue(index); break; case Integer16Property: ((MP4Integer16Property*)this)->DeleteValue(index); break; case Integer24Property: ((MP4Integer24Property*)this)->DeleteValue(index); break; case Integer32Property: ((MP4Integer32Property*)this)->DeleteValue(index); break; case Integer64Property: ((MP4Integer64Property*)this)->DeleteValue(index); break; default: ASSERT(FALSE); } } void MP4IntegerProperty::IncrementValue(int32_t increment, u_int32_t index) { SetValue(GetValue() + increment); } void MP4Integer8Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = %u (0x%02x)\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, "%s = %u (0x%02x)\n", m_name, m_values[index], m_values[index]); fflush(pFile); } void MP4Integer16Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = %u (0x%04x)\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, "%s = %u (0x%04x)\n", m_name, m_values[index], m_values[index]); fflush(pFile); } void MP4Integer24Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = %u (0x%06x)\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, "%s = %u (0x%06x)\n", m_name, m_values[index], m_values[index]); fflush(pFile); } void MP4Integer32Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = %u (0x%08x)\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, "%s = %u (0x%08x)\n", m_name, m_values[index], m_values[index]); fflush(pFile); } void MP4Integer64Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = "U64" (0x%016"X64F")\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, "%s = "U64" (0x%016"X64F")\n", m_name, m_values[index], m_values[index]); fflush(pFile); } // MP4BitfieldProperty void MP4BitfieldProperty::Read(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } m_values[index] = pFile->ReadBits(m_numBits); } void MP4BitfieldProperty::Write(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } pFile->WriteBits(m_values[index], m_numBits); } void MP4BitfieldProperty::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); u_int8_t hexWidth = m_numBits / 4; if (hexWidth == 0 || (m_numBits % 4)) { hexWidth++; } if (index != 0) fprintf(pFile, "%s[%u] = "U64" (0x%0*"X64F") <%u bits>\n", m_name, index, m_values[index], (int)hexWidth, m_values[index], m_numBits); else fprintf(pFile, "%s = "U64" (0x%0*"X64F") <%u bits>\n", m_name, m_values[index], (int)hexWidth, m_values[index], m_numBits); fflush(pFile); } // MP4Float32Property void MP4Float32Property::Read(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } if (m_useFixed16Format) { m_values[index] = pFile->ReadFixed16(); } else if (m_useFixed32Format) { m_values[index] = pFile->ReadFixed32(); } else { m_values[index] = pFile->ReadFloat(); } } void MP4Float32Property::Write(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } if (m_useFixed16Format) { pFile->WriteFixed16(m_values[index]); } else if (m_useFixed32Format) { pFile->WriteFixed32(m_values[index]); } else { pFile->WriteFloat(m_values[index]); } } void MP4Float32Property::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u] = %f\n", m_name, index, m_values[index]); else fprintf(pFile, "%s = %f\n", m_name, m_values[index]); fflush(pFile); } // MP4StringProperty MP4StringProperty::MP4StringProperty(char* name, bool useCountedFormat, bool useUnicode) : MP4Property(name) { SetCount(1); m_values[0] = NULL; m_useCountedFormat = useCountedFormat; m_useExpandedCount = false; m_useUnicode = useUnicode; m_fixedLength = 0; // length not fixed } MP4StringProperty::~MP4StringProperty() { u_int32_t count = GetCount(); for (u_int32_t i = 0; i < count; i++) { MP4Free(m_values[i]); } } void MP4StringProperty::SetCount(u_int32_t count) { u_int32_t oldCount = m_values.Size(); m_values.Resize(count); for (u_int32_t i = oldCount; i < count; i++) { m_values[i] = NULL; } } void MP4StringProperty::SetValue(const char* value, u_int32_t index) { if (m_readOnly) { throw new MP4Error(EACCES, "property is read-only", m_name); } MP4Free(m_values[index]); if (m_fixedLength) { m_values[index] = (char*)MP4Calloc(m_fixedLength + 1); if (value) { strncpy(m_values[index], value, m_fixedLength); } } else { if (value) { m_values[index] = MP4Stralloc(value); } else { m_values[index] = NULL; } } } void MP4StringProperty::Read(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } if (m_useCountedFormat) { m_values[index] = pFile->ReadCountedString( (m_useUnicode ? 2 : 1), m_useExpandedCount); } else if (m_fixedLength) { MP4Free(m_values[index]); m_values[index] = (char*)MP4Calloc(m_fixedLength + 1); pFile->ReadBytes((u_int8_t*)m_values[index], m_fixedLength); } else { m_values[index] = pFile->ReadString(); } } void MP4StringProperty::Write(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } if (m_useCountedFormat) { pFile->WriteCountedString(m_values[index], (m_useUnicode ? 2 : 1), m_useExpandedCount); } else if (m_fixedLength) { pFile->WriteBytes((u_int8_t*)m_values[index], m_fixedLength); } else { pFile->WriteString(m_values[index]); } } void MP4StringProperty::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); char indexd[32]; if (index != 0) { snprintf(indexd, 32, "[%u]", index); } else indexd[0] = '\0'; if (m_useUnicode) { fprintf(pFile, "%s%s = %ls\n", m_name, indexd, (wchar_t*)m_values[index]); } else { fprintf(pFile, "%s%s = %s\n", m_name, indexd, m_values[index]); } fflush(pFile); } // MP4BytesProperty MP4BytesProperty::MP4BytesProperty(char* name, u_int32_t valueSize, u_int32_t defaultValueSize) : MP4Property(name) { SetCount(1); m_values[0] = (u_int8_t*)MP4Calloc(valueSize); m_valueSizes[0] = valueSize; m_fixedValueSize = 0; m_defaultValueSize = defaultValueSize; } MP4BytesProperty::~MP4BytesProperty() { u_int32_t count = GetCount(); for (u_int32_t i = 0; i < count; i++) { MP4Free(m_values[i]); } } void MP4BytesProperty::SetCount(u_int32_t count) { u_int32_t oldCount = m_values.Size(); m_values.Resize(count); m_valueSizes.Resize(count); for (u_int32_t i = oldCount; i < count; i++) { m_values[i] = NULL; m_valueSizes[i] = m_defaultValueSize; } } void MP4BytesProperty::SetValue(const u_int8_t* pValue, u_int32_t valueSize, u_int32_t index) { if (m_readOnly) { throw new MP4Error(EACCES, "property is read-only", m_name); } if (m_fixedValueSize) { if (valueSize > m_fixedValueSize) { throw new MP4Error("%s.%s value size %d exceeds fixed value size %d", "MP4BytesProperty::SetValue", GetParentAtom()->GetType(), GetName(), valueSize, m_fixedValueSize); } if (m_values[index] == NULL) { m_values[index] = (u_int8_t*)MP4Calloc(m_fixedValueSize); m_valueSizes[index] = m_fixedValueSize; } if (pValue) { memcpy(m_values[index], pValue, valueSize); } } else { MP4Free(m_values[index]); if (pValue) { m_values[index] = (u_int8_t*)MP4Malloc(valueSize); memcpy(m_values[index], pValue, valueSize); m_valueSizes[index] = valueSize; } else { m_values[index] = NULL; m_valueSizes[index] = 0; } } } void MP4BytesProperty::SetValueSize(u_int32_t valueSize, u_int32_t index) { if (m_fixedValueSize) { throw new MP4Error("can't change size of fixed sized property", "MP4BytesProperty::SetValueSize"); } if (m_values[index] != NULL) { m_values[index] = (u_int8_t*)MP4Realloc(m_values[index], valueSize); } m_valueSizes[index] = valueSize; } void MP4BytesProperty::SetFixedSize(u_int32_t fixedSize) { m_fixedValueSize = 0; for (u_int32_t i = 0; i < GetCount(); i++) { SetValueSize(fixedSize, i); } m_fixedValueSize = fixedSize; } void MP4BytesProperty::Read(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } MP4Free(m_values[index]); m_values[index] = (u_int8_t*)MP4Malloc(m_valueSizes[index]); pFile->ReadBytes(m_values[index], m_valueSizes[index]); } void MP4BytesProperty::Write(MP4File* pFile, u_int32_t index) { if (m_implicit) { return; } pFile->WriteBytes(m_values[index], m_valueSizes[index]); } void MP4BytesProperty::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { if (m_implicit && !dumpImplicits) { return; } Indent(pFile, indent); fputs(m_name, pFile); if (index != 0) fprintf(pFile, "[%u]", index); fprintf(pFile, " = <%u bytes> ", m_valueSizes[index]); for (u_int32_t i = 0; i < m_valueSizes[index]; i++) { if ((i % 16) == 0 && m_valueSizes[index] > 16) { fprintf(pFile, "\n"); Indent(pFile, indent); } fprintf(pFile, "%02x ", m_values[index][i]); } fprintf(pFile, "\n"); fflush(pFile); } // MP4TableProperty MP4TableProperty::MP4TableProperty(char* name, MP4IntegerProperty* pCountProperty) : MP4Property(name) { m_pCountProperty = pCountProperty; m_pCountProperty->SetReadOnly(); } MP4TableProperty::~MP4TableProperty() { for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { delete m_pProperties[i]; } } void MP4TableProperty::AddProperty(MP4Property* pProperty) { ASSERT(pProperty); ASSERT(pProperty->GetType() != TableProperty); ASSERT(pProperty->GetType() != DescriptorProperty); m_pProperties.Add(pProperty); pProperty->SetParentAtom(m_pParentAtom); pProperty->SetCount(0); } bool MP4TableProperty::FindProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { ASSERT(m_name); // check if first component of name matches ourselves if (!MP4NameFirstMatches(m_name, name)) { return false; } // check if the specified table entry exists u_int32_t index; bool haveIndex = MP4NameFirstIndex(name, &index); if (haveIndex) { if (index >= GetCount()) { return false; } if (pIndex) { *pIndex = index; } } VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), printf("FindProperty: matched %s\n", name)); // get name of table property const char *tablePropName = MP4NameAfterFirst(name); if (tablePropName == NULL) { if (!haveIndex) { *ppProperty = this; return true; } return false; } // check if this table property exists return FindContainedProperty(tablePropName, ppProperty, pIndex); } bool MP4TableProperty::FindContainedProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { u_int32_t numProperties = m_pProperties.Size(); for (u_int32_t i = 0; i < numProperties; i++) { if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { return true; } } return false; } void MP4TableProperty::Read(MP4File* pFile, u_int32_t index) { ASSERT(index == 0); if (m_implicit) { return; } u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } u_int32_t numEntries = GetCount(); /* for each property set size */ for (u_int32_t j = 0; j < numProperties; j++) { m_pProperties[j]->SetCount(numEntries); } for (u_int32_t i = 0; i < numEntries; i++) { ReadEntry(pFile, i); } } void MP4TableProperty::ReadEntry(MP4File* pFile, u_int32_t index) { for (u_int32_t j = 0; j < m_pProperties.Size(); j++) { m_pProperties[j]->Read(pFile, index); } } void MP4TableProperty::Write(MP4File* pFile, u_int32_t index) { ASSERT(index == 0); if (m_implicit) { return; } u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } u_int32_t numEntries = GetCount(); if (m_pProperties[0]->GetCount() != numEntries) { fprintf(stderr, "%s %s \"%s\"table entries %u doesn't match count %u\n", GetParentAtom() != NULL ? GetParentAtom()->GetType() : "", GetName(), m_pProperties[0]->GetName(), m_pProperties[0]->GetCount(), numEntries); ASSERT(m_pProperties[0]->GetCount() == numEntries); } for (u_int32_t i = 0; i < numEntries; i++) { WriteEntry(pFile, i); } } void MP4TableProperty::WriteEntry(MP4File* pFile, u_int32_t index) { for (u_int32_t j = 0; j < m_pProperties.Size(); j++) { m_pProperties[j]->Write(pFile, index); } } void MP4TableProperty::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { ASSERT(index == 0); // implicit tables just can't be dumped if (m_implicit) { return; } u_int32_t numProperties = m_pProperties.Size(); if (numProperties == 0) { WARNING(numProperties == 0); return; } u_int32_t numEntries = GetCount(); for (u_int32_t i = 0; i < numEntries; i++) { for (u_int32_t j = 0; j < numProperties; j++) { m_pProperties[j]->Dump(pFile, indent + 1, dumpImplicits, i); } } } // MP4DescriptorProperty MP4DescriptorProperty::MP4DescriptorProperty(char* name, u_int8_t tagsStart, u_int8_t tagsEnd, bool mandatory, bool onlyOne) : MP4Property(name) { SetTags(tagsStart, tagsEnd); m_sizeLimit = 0; m_mandatory = mandatory; m_onlyOne = onlyOne; } MP4DescriptorProperty::~MP4DescriptorProperty() { for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { delete m_pDescriptors[i]; } } void MP4DescriptorProperty::SetParentAtom(MP4Atom* pParentAtom) { m_pParentAtom = pParentAtom; for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { m_pDescriptors[i]->SetParentAtom(pParentAtom); } } MP4Descriptor* MP4DescriptorProperty::AddDescriptor(u_int8_t tag) { // check that tag is in expected range ASSERT(tag >= m_tagsStart && tag <= m_tagsEnd); MP4Descriptor* pDescriptor = CreateDescriptor(tag); ASSERT(pDescriptor); m_pDescriptors.Add(pDescriptor); pDescriptor->SetParentAtom(m_pParentAtom); return pDescriptor; } void MP4DescriptorProperty::DeleteDescriptor(u_int32_t index) { delete m_pDescriptors[index]; m_pDescriptors.Delete(index); } void MP4DescriptorProperty::Generate() { // generate a default descriptor // if it is mandatory, and single if (m_mandatory && m_onlyOne) { MP4Descriptor* pDescriptor = AddDescriptor(m_tagsStart); pDescriptor->Generate(); } } bool MP4DescriptorProperty::FindProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { // we're unnamed, so just check contained properties if (m_name == NULL || !strcmp(m_name, "")) { return FindContainedProperty(name, ppProperty, pIndex); } // check if first component of name matches ourselves if (!MP4NameFirstMatches(m_name, name)) { return false; } // check if the specific descriptor entry exists u_int32_t descrIndex; bool haveDescrIndex = MP4NameFirstIndex(name, &descrIndex); if (haveDescrIndex && descrIndex >= GetCount()) { return false; } if (m_pParentAtom) { VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), printf("FindProperty: matched %s\n", name)); } // get name of descriptor property name = MP4NameAfterFirst(name); if (name == NULL) { if (!haveDescrIndex) { *ppProperty = this; return true; } return false; } /* check rest of name */ if (haveDescrIndex) { return m_pDescriptors[descrIndex]->FindProperty(name, ppProperty, pIndex); } else { return FindContainedProperty(name, ppProperty, pIndex); } } bool MP4DescriptorProperty::FindContainedProperty(const char *name, MP4Property** ppProperty, u_int32_t* pIndex) { for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { if (m_pDescriptors[i]->FindProperty(name, ppProperty, pIndex)) { return true; } } return false; } void MP4DescriptorProperty::Read(MP4File* pFile, u_int32_t index) { ASSERT(index == 0); if (m_implicit) { return; } u_int64_t start = pFile->GetPosition(); while (true) { // enforce size limitation if (m_sizeLimit && pFile->GetPosition() >= start + m_sizeLimit) { break; } u_int8_t tag; try { pFile->PeekBytes(&tag, 1); } catch (MP4Error* e) { if (pFile->GetPosition() >= pFile->GetSize()) { // EOF delete e; break; } throw e; } // check if tag is in desired range if (tag < m_tagsStart || tag > m_tagsEnd) { break; } MP4Descriptor* pDescriptor = AddDescriptor(tag); pDescriptor->Read(pFile); } // warnings if (m_mandatory && m_pDescriptors.Size() == 0) { VERBOSE_READ(pFile->GetVerbosity(), printf("Warning: Mandatory descriptor 0x%02x missing\n", m_tagsStart)); } else if (m_onlyOne && m_pDescriptors.Size() > 1) { VERBOSE_READ(pFile->GetVerbosity(), printf("Warning: Descriptor 0x%02x has more than one instance\n", m_tagsStart)); } } void MP4DescriptorProperty::Write(MP4File* pFile, u_int32_t index) { ASSERT(index == 0); if (m_implicit) { return; } for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { m_pDescriptors[i]->Write(pFile); } } void MP4DescriptorProperty::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index) { ASSERT(index == 0); if (m_implicit && !dumpImplicits) { return; } if (m_name) { Indent(pFile, indent); if (index != 0) fprintf(pFile, "%s[%u]\n", m_name, index); else fprintf(pFile, "%s\n", m_name); indent++; } for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { m_pDescriptors[i]->Dump(pFile, indent, dumpImplicits); } } faac-1.28/common/mp4v2/mp4property.h0000644010307701030770000003067111136736372021002 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_PROPERTY_INCLUDED__ #define __MP4_PROPERTY_INCLUDED__ // forward declarations class MP4Atom; class MP4Descriptor; MP4ARRAY_DECL(MP4Descriptor, MP4Descriptor*); enum MP4PropertyType { Integer8Property, Integer16Property, Integer24Property, Integer32Property, Integer64Property, Float32Property, StringProperty, BytesProperty, TableProperty, DescriptorProperty, }; class MP4Property { public: MP4Property(const char *name = NULL); virtual ~MP4Property() { } MP4Atom* GetParentAtom() { return m_pParentAtom; } virtual void SetParentAtom(MP4Atom* pParentAtom) { m_pParentAtom = pParentAtom; } const char *GetName() { return m_name; } virtual MP4PropertyType GetType() = 0; bool IsReadOnly() { return m_readOnly; } void SetReadOnly(bool value = true) { m_readOnly = value; } bool IsImplicit() { return m_implicit; } void SetImplicit(bool value = true) { m_implicit = value; } virtual u_int32_t GetCount() = 0; virtual void SetCount(u_int32_t count) = 0; virtual void Generate() { /* default is a no-op */ }; virtual void Read(MP4File* pFile, u_int32_t index = 0) = 0; virtual void Write(MP4File* pFile, u_int32_t index = 0) = 0; virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0) = 0; virtual bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); protected: MP4Atom* m_pParentAtom; const char* m_name; bool m_readOnly; bool m_implicit; }; MP4ARRAY_DECL(MP4Property, MP4Property*); class MP4IntegerProperty : public MP4Property { protected: MP4IntegerProperty(char* name) : MP4Property(name) { }; public: u_int64_t GetValue(u_int32_t index = 0); void SetValue(u_int64_t value, u_int32_t index = 0); void InsertValue(u_int64_t value, u_int32_t index = 0); void DeleteValue(u_int32_t index = 0); void IncrementValue(int32_t increment = 1, u_int32_t index = 0); }; #define MP4INTEGER_PROPERTY_DECL2(isize, xsize) \ class MP4Integer##xsize##Property : public MP4IntegerProperty { \ public: \ MP4Integer##xsize##Property(char* name) \ : MP4IntegerProperty(name) { \ SetCount(1); \ m_values[0] = 0; \ } \ \ MP4PropertyType GetType() { \ return Integer##xsize##Property; \ } \ \ u_int32_t GetCount() { \ return m_values.Size(); \ } \ void SetCount(u_int32_t count) { \ m_values.Resize(count); \ } \ \ u_int##isize##_t GetValue(u_int32_t index = 0) { \ return m_values[index]; \ } \ \ void SetValue(u_int##isize##_t value, u_int32_t index = 0) { \ if (m_readOnly) { \ throw new MP4Error(EACCES, "property is read-only", m_name); \ } \ m_values[index] = value; \ } \ void AddValue(u_int##isize##_t value) { \ m_values.Add(value); \ } \ void InsertValue(u_int##isize##_t value, u_int32_t index) { \ m_values.Insert(value, index); \ } \ void DeleteValue(u_int32_t index) { \ m_values.Delete(index); \ } \ void IncrementValue(int32_t increment = 1, u_int32_t index = 0) { \ m_values[index] += increment; \ } \ void Read(MP4File* pFile, u_int32_t index = 0) { \ if (m_implicit) { \ return; \ } \ m_values[index] = pFile->ReadUInt##xsize(); \ } \ \ void Write(MP4File* pFile, u_int32_t index = 0) { \ if (m_implicit) { \ return; \ } \ pFile->WriteUInt##xsize(m_values[index]); \ } \ void Dump(FILE* pFile, u_int8_t indent, \ bool dumpImplicits, u_int32_t index = 0); \ \ protected: \ MP4Integer##isize##Array m_values; \ }; #define MP4INTEGER_PROPERTY_DECL(size) \ MP4INTEGER_PROPERTY_DECL2(size, size) MP4INTEGER_PROPERTY_DECL(8); MP4INTEGER_PROPERTY_DECL(16); MP4INTEGER_PROPERTY_DECL2(32, 24); MP4INTEGER_PROPERTY_DECL(32); MP4INTEGER_PROPERTY_DECL(64); class MP4BitfieldProperty : public MP4Integer64Property { public: MP4BitfieldProperty(char* name, u_int8_t numBits) : MP4Integer64Property(name) { ASSERT(numBits != 0); ASSERT(numBits <= 64); m_numBits = numBits; } u_int8_t GetNumBits() { return m_numBits; } void SetNumBits(u_int8_t numBits) { m_numBits = numBits; } void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); protected: u_int8_t m_numBits; }; class MP4Float32Property : public MP4Property { public: MP4Float32Property(char* name) : MP4Property(name) { m_useFixed16Format = false; m_useFixed32Format = false; SetCount(1); m_values[0] = 0.0; } MP4PropertyType GetType() { return Float32Property; } u_int32_t GetCount() { return m_values.Size(); } void SetCount(u_int32_t count) { m_values.Resize(count); } float GetValue(u_int32_t index = 0) { return m_values[index]; } void SetValue(float value, u_int32_t index = 0) { if (m_readOnly) { throw new MP4Error(EACCES, "property is read-only", m_name); } m_values[index] = value; } void AddValue(float value) { m_values.Add(value); } void InsertValue(float value, u_int32_t index) { m_values.Insert(value, index); } bool IsFixed16Format() { return m_useFixed16Format; } void SetFixed16Format(bool useFixed16Format = true) { m_useFixed16Format = useFixed16Format; } bool IsFixed32Format() { return m_useFixed32Format; } void SetFixed32Format(bool useFixed32Format = true) { m_useFixed32Format = useFixed32Format; } void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); protected: bool m_useFixed16Format; bool m_useFixed32Format; MP4Float32Array m_values; }; class MP4StringProperty : public MP4Property { public: MP4StringProperty(char* name, bool useCountedFormat = false, bool useUnicode = false); ~MP4StringProperty(); MP4PropertyType GetType() { return StringProperty; } u_int32_t GetCount() { return m_values.Size(); } void SetCount(u_int32_t count); const char* GetValue(u_int32_t index = 0) { return m_values[index]; } void SetValue(const char* value, u_int32_t index = 0); void AddValue(const char* value) { u_int32_t count = GetCount(); SetCount(count + 1); SetValue(value, count); } bool IsCountedFormat() { return m_useCountedFormat; } void SetCountedFormat(bool useCountedFormat) { m_useCountedFormat = useCountedFormat; } bool IsExpandedCountedFormat() { return m_useExpandedCount; } void SetExpandedCountedFormat(bool useExpandedCount) { m_useExpandedCount = useExpandedCount; } bool IsUnicode() { return m_useUnicode; } void SetUnicode(bool useUnicode) { m_useUnicode = useUnicode; } u_int32_t GetFixedLength() { return m_fixedLength; } void SetFixedLength(u_int32_t fixedLength) { m_fixedLength = fixedLength; } void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); protected: bool m_useCountedFormat; bool m_useExpandedCount; bool m_useUnicode; u_int32_t m_fixedLength; MP4StringArray m_values; }; class MP4BytesProperty : public MP4Property { public: MP4BytesProperty(char* name, u_int32_t valueSize = 0, u_int32_t defaultValueSize = 0); ~MP4BytesProperty(); MP4PropertyType GetType() { return BytesProperty; } u_int32_t GetCount() { return m_values.Size(); } void SetCount(u_int32_t count); void GetValue(u_int8_t** ppValue, u_int32_t* pValueSize, u_int32_t index = 0) { // N.B. caller must free memory *ppValue = (u_int8_t*)MP4Malloc(m_valueSizes[index]); memcpy(*ppValue, m_values[index], m_valueSizes[index]); *pValueSize = m_valueSizes[index]; } void CopyValue(u_int8_t* pValue, u_int32_t index = 0) { // N.B. caller takes responsbility for valid pointer // and sufficient memory at the destination memcpy(pValue, m_values[index], m_valueSizes[index]); } void SetValue(const u_int8_t* pValue, u_int32_t valueSize, u_int32_t index = 0); void AddValue(const u_int8_t* pValue, u_int32_t valueSize) { u_int32_t count = GetCount(); SetCount(count + 1); SetValue(pValue, valueSize, count); } u_int32_t GetValueSize(u_int32_t valueSize, u_int32_t index = 0) { return m_valueSizes[index]; } void SetValueSize(u_int32_t valueSize, u_int32_t index = 0); u_int32_t GetFixedSize() { return m_fixedValueSize; } void SetFixedSize(u_int32_t fixedSize); void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); protected: u_int32_t m_fixedValueSize; u_int32_t m_defaultValueSize; MP4Integer32Array m_valueSizes; MP4BytesArray m_values; }; class MP4TableProperty : public MP4Property { public: MP4TableProperty(char* name, MP4IntegerProperty* pCountProperty); ~MP4TableProperty(); MP4PropertyType GetType() { return TableProperty; } void SetParentAtom(MP4Atom* pParentAtom) { m_pParentAtom = pParentAtom; for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { m_pProperties[i]->SetParentAtom(pParentAtom); } } void AddProperty(MP4Property* pProperty); MP4Property* GetProperty(u_int32_t index) { return m_pProperties[index]; } virtual u_int32_t GetCount() { return m_pCountProperty->GetValue(); } virtual void SetCount(u_int32_t count) { m_pCountProperty->SetValue(count); } void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); protected: virtual void ReadEntry(MP4File* pFile, u_int32_t index); virtual void WriteEntry(MP4File* pFile, u_int32_t index); bool FindContainedProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex); protected: MP4IntegerProperty* m_pCountProperty; MP4PropertyArray m_pProperties; }; class MP4DescriptorProperty : public MP4Property { public: MP4DescriptorProperty(char* name = NULL, u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0, bool mandatory = false, bool onlyOne = false); ~MP4DescriptorProperty(); MP4PropertyType GetType() { return DescriptorProperty; } void SetParentAtom(MP4Atom* pParentAtom); void SetSizeLimit(u_int64_t sizeLimit) { m_sizeLimit = sizeLimit; } u_int32_t GetCount() { return m_pDescriptors.Size(); } void SetCount(u_int32_t count) { m_pDescriptors.Resize(count); } void SetTags(u_int8_t tagsStart, u_int8_t tagsEnd = 0) { m_tagsStart = tagsStart; m_tagsEnd = tagsEnd ? tagsEnd : tagsStart; } MP4Descriptor* AddDescriptor(u_int8_t tag); void AppendDescriptor(MP4Descriptor* pDescriptor) { m_pDescriptors.Add(pDescriptor); } void DeleteDescriptor(u_int32_t index); void Generate(); void Read(MP4File* pFile, u_int32_t index = 0); void Write(MP4File* pFile, u_int32_t index = 0); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits, u_int32_t index = 0); bool FindProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex = NULL); protected: virtual MP4Descriptor* CreateDescriptor(u_int8_t tag); bool FindContainedProperty(const char* name, MP4Property** ppProperty, u_int32_t* pIndex); protected: u_int8_t m_tagsStart; u_int8_t m_tagsEnd; u_int64_t m_sizeLimit; bool m_mandatory; bool m_onlyOne; MP4DescriptorArray m_pDescriptors; }; class MP4QosQualifierProperty : public MP4DescriptorProperty { public: MP4QosQualifierProperty(char* name = NULL, u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0, bool mandatory = false, bool onlyOne = false) : MP4DescriptorProperty(name, tagsStart, tagsEnd, mandatory, onlyOne) { } protected: MP4Descriptor* CreateDescriptor(u_int8_t tag); }; #endif /* __MP4_PROPERTY_INCLUDED__ */ faac-1.28/common/mp4v2/mp4track.cpp0000644010307701030770000013725211136736372020560 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #include "mp4common.h" #define AMR_UNINITIALIZED -1 #define AMR_TRUE 0 #define AMR_FALSE 1 MP4Track::MP4Track(MP4File* pFile, MP4Atom* pTrakAtom) { m_pFile = pFile; m_pTrakAtom = pTrakAtom; m_lastStsdIndex = 0; m_lastSampleFile = NULL; m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID; m_pCachedReadSample = NULL; m_cachedReadSampleSize = 0; m_writeSampleId = 1; m_fixedSampleDuration = 0; m_pChunkBuffer = NULL; m_chunkBufferSize = 0; m_chunkSamples = 0; m_chunkDuration = 0; // m_bytesPerSample should be set to 1, except for the // quicktime audio constant bit rate samples, which have non-1 values m_bytesPerSample = 1; m_samplesPerChunk = 0; m_durationPerChunk = 0; m_isAmr = AMR_UNINITIALIZED; m_curMode = 0; m_cachedSttsSid = MP4_INVALID_SAMPLE_ID; bool success = true; MP4Integer32Property* pTrackIdProperty; success &= m_pTrakAtom->FindProperty( "trak.tkhd.trackId", (MP4Property**)&pTrackIdProperty); if (success) { m_trackId = pTrackIdProperty->GetValue(); } success &= m_pTrakAtom->FindProperty( "trak.mdia.mdhd.timeScale", (MP4Property**)&m_pTimeScaleProperty); if (success) { // default chunking is 1 second of samples m_durationPerChunk = m_pTimeScaleProperty->GetValue(); } success &= m_pTrakAtom->FindProperty( "trak.tkhd.duration", (MP4Property**)&m_pTrackDurationProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.mdhd.duration", (MP4Property**)&m_pMediaDurationProperty); success &= m_pTrakAtom->FindProperty( "trak.tkhd.modificationTime", (MP4Property**)&m_pTrackModificationProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.mdhd.modificationTime", (MP4Property**)&m_pMediaModificationProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.hdlr.handlerType", (MP4Property**)&m_pTypeProperty); // get handles on sample size information m_pStszFixedSampleSizeProperty = NULL; bool have_stsz = m_pTrakAtom->FindProperty("trak.mdia.minf.stbl.stsz.sampleSize", (MP4Property**)&m_pStszFixedSampleSizeProperty); if (have_stsz) { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsz.sampleCount", (MP4Property**)&m_pStszSampleCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsz.entries.entrySize", (MP4Property**)&m_pStszSampleSizeProperty); m_stsz_sample_bits = 32; } else { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stz2.sampleCount", (MP4Property**)&m_pStszSampleCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stz2.entries.entrySize", (MP4Property**)&m_pStszSampleSizeProperty); MP4Integer8Property *stz2_field_size; if (m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stz2.fieldSize", (MP4Property **)&stz2_field_size)) { m_stsz_sample_bits = stz2_field_size->GetValue(); m_have_stz2_4bit_sample = false; } else success = false; } // get handles on information needed to map sample id's to file offsets success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsc.entryCount", (MP4Property**)&m_pStscCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsc.entries.firstChunk", (MP4Property**)&m_pStscFirstChunkProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsc.entries.samplesPerChunk", (MP4Property**)&m_pStscSamplesPerChunkProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsc.entries.sampleDescriptionIndex", (MP4Property**)&m_pStscSampleDescrIndexProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsc.entries.firstSample", (MP4Property**)&m_pStscFirstSampleProperty); bool haveStco = m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stco.entryCount", (MP4Property**)&m_pChunkCountProperty); if (haveStco) { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stco.entries.chunkOffset", (MP4Property**)&m_pChunkOffsetProperty); } else { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.co64.entryCount", (MP4Property**)&m_pChunkCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.co64.entries.chunkOffset", (MP4Property**)&m_pChunkOffsetProperty); } // get handles on sample timing info success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stts.entryCount", (MP4Property**)&m_pSttsCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stts.entries.sampleCount", (MP4Property**)&m_pSttsSampleCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stts.entries.sampleDelta", (MP4Property**)&m_pSttsSampleDeltaProperty); // get handles on rendering offset info if it exists m_pCttsCountProperty = NULL; m_pCttsSampleCountProperty = NULL; m_pCttsSampleOffsetProperty = NULL; bool haveCtts = m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.ctts.entryCount", (MP4Property**)&m_pCttsCountProperty); if (haveCtts) { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.ctts.entries.sampleCount", (MP4Property**)&m_pCttsSampleCountProperty); success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.ctts.entries.sampleOffset", (MP4Property**)&m_pCttsSampleOffsetProperty); } // get handles on sync sample info if it exists m_pStssCountProperty = NULL; m_pStssSampleProperty = NULL; bool haveStss = m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stss.entryCount", (MP4Property**)&m_pStssCountProperty); if (haveStss) { success &= m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stss.entries.sampleNumber", (MP4Property**)&m_pStssSampleProperty); } // edit list (void)InitEditListProperties(); // was everything found? if (!success) { throw new MP4Error("invalid track", "MP4Track::MP4Track"); } CalculateBytesPerSample(); } MP4Track::~MP4Track() { MP4Free(m_pCachedReadSample); MP4Free(m_pChunkBuffer); } const char* MP4Track::GetType() { return m_pTypeProperty->GetValue(); } void MP4Track::SetType(const char* type) { m_pTypeProperty->SetValue(MP4NormalizeTrackType(type, m_pFile->GetVerbosity())); } void MP4Track::ReadSample( MP4SampleId sampleId, u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample) { if (sampleId == MP4_INVALID_SAMPLE_ID) { throw new MP4Error("sample id can't be zero", "MP4Track::ReadSample"); } // handle unusual case of wanting to read a sample // that is still sitting in the write chunk buffer if (m_pChunkBuffer && sampleId >= m_writeSampleId - m_chunkSamples) { WriteChunkBuffer(); } FILE* pFile = GetSampleFile(sampleId); if (pFile == (FILE*)-1) { throw new MP4Error("sample is located in an inaccessible file", "MP4Track::ReadSample"); } u_int64_t fileOffset = GetSampleFileOffset(sampleId); u_int32_t sampleSize = GetSampleSize(sampleId); if (*ppBytes != NULL && *pNumBytes < sampleSize) { throw new MP4Error("sample buffer is too small", "MP4Track::ReadSample"); } *pNumBytes = sampleSize; VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("ReadSample: track %u id %u offset 0x"X64" size %u (0x%x)\n", m_trackId, sampleId, fileOffset, *pNumBytes, *pNumBytes)); bool bufferMalloc = false; if (*ppBytes == NULL) { *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); bufferMalloc = true; } u_int64_t oldPos = m_pFile->GetPosition(pFile); // only used in mode == 'w' try { m_pFile->SetPosition(fileOffset, pFile); m_pFile->ReadBytes(*ppBytes, *pNumBytes, pFile); if (pStartTime || pDuration) { GetSampleTimes(sampleId, pStartTime, pDuration); VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("ReadSample: start "U64" duration "D64"\n", (pStartTime ? *pStartTime : 0), (pDuration ? *pDuration : 0))); } if (pRenderingOffset) { *pRenderingOffset = GetSampleRenderingOffset(sampleId); VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("ReadSample: renderingOffset "D64"\n", *pRenderingOffset)); } if (pIsSyncSample) { *pIsSyncSample = IsSyncSample(sampleId); VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("ReadSample: isSyncSample %u\n", *pIsSyncSample)); } } catch (MP4Error* e) { if (bufferMalloc) { // let's not leak memory MP4Free(*ppBytes); *ppBytes = NULL; } if (m_pFile->GetMode() == 'w') { m_pFile->SetPosition(oldPos, pFile); } throw e; } if (m_pFile->GetMode() == 'w') { m_pFile->SetPosition(oldPos, pFile); } } void MP4Track::ReadSampleFragment( MP4SampleId sampleId, u_int32_t sampleOffset, u_int16_t sampleLength, u_int8_t* pDest) { if (sampleId == MP4_INVALID_SAMPLE_ID) { throw new MP4Error("invalid sample id", "MP4Track::ReadSampleFragment"); } if (sampleId != m_cachedReadSampleId) { MP4Free(m_pCachedReadSample); m_pCachedReadSample = NULL; m_cachedReadSampleSize = 0; m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID; ReadSample( sampleId, &m_pCachedReadSample, &m_cachedReadSampleSize); m_cachedReadSampleId = sampleId; } if (sampleOffset + sampleLength > m_cachedReadSampleSize) { throw new MP4Error("offset and/or length are too large", "MP4Track::ReadSampleFragment"); } memcpy(pDest, &m_pCachedReadSample[sampleOffset], sampleLength); } void MP4Track::WriteSample( const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample) { u_int8_t curMode = 0; VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), printf("WriteSample: track %u id %u size %u (0x%x) ", m_trackId, m_writeSampleId, numBytes, numBytes)); if (pBytes == NULL && numBytes > 0) { throw new MP4Error("no sample data", "MP4WriteSample"); } if (m_isAmr == AMR_UNINITIALIZED ) { // figure out if this is an AMR audio track if (m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd.samr") || m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd.sawb")) { m_isAmr = AMR_TRUE; m_curMode = (pBytes[0] >> 3) & 0x000F; } else { m_isAmr = AMR_FALSE; } } if (m_isAmr == AMR_TRUE) { curMode = (pBytes[0] >> 3) &0x000F; // The mode is in the first byte } if (duration == MP4_INVALID_DURATION) { duration = GetFixedSampleDuration(); } VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), printf("duration "U64"\n", duration)); if ((m_isAmr == AMR_TRUE) && (m_curMode != curMode)) { WriteChunkBuffer(); m_curMode = curMode; } // append sample bytes to chunk buffer m_pChunkBuffer = (u_int8_t*)MP4Realloc(m_pChunkBuffer, m_chunkBufferSize + numBytes); if (m_pChunkBuffer == NULL) return; memcpy(&m_pChunkBuffer[m_chunkBufferSize], pBytes, numBytes); m_chunkBufferSize += numBytes; m_chunkSamples++; m_chunkDuration += duration; UpdateSampleSizes(m_writeSampleId, numBytes); UpdateSampleTimes(duration); UpdateRenderingOffsets(m_writeSampleId, renderingOffset); UpdateSyncSamples(m_writeSampleId, isSyncSample); if (IsChunkFull(m_writeSampleId)) { WriteChunkBuffer(); m_curMode = curMode; } UpdateDurations(duration); UpdateModificationTimes(); m_writeSampleId++; } void MP4Track::WriteChunkBuffer() { if (m_chunkBufferSize == 0) { return; } u_int64_t chunkOffset = m_pFile->GetPosition(); // write chunk buffer m_pFile->WriteBytes(m_pChunkBuffer, m_chunkBufferSize); VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), printf("WriteChunk: track %u offset 0x"X64" size %u (0x%x) numSamples %u\n", m_trackId, chunkOffset, m_chunkBufferSize, m_chunkBufferSize, m_chunkSamples)); UpdateSampleToChunk(m_writeSampleId, m_pChunkCountProperty->GetValue() + 1, m_chunkSamples); UpdateChunkOffsets(chunkOffset); // clean up chunk buffer MP4Free(m_pChunkBuffer); m_pChunkBuffer = NULL; m_chunkBufferSize = 0; m_chunkSamples = 0; m_chunkDuration = 0; } void MP4Track::FinishWrite() { // write out any remaining samples in chunk buffer WriteChunkBuffer(); if (m_pStszFixedSampleSizeProperty == NULL && m_stsz_sample_bits == 4) { if (m_have_stz2_4bit_sample) { ((MP4Integer8Property *)m_pStszSampleSizeProperty)->AddValue(m_stz2_4bit_sample_value); m_pStszSampleSizeProperty->IncrementValue(); } } // record buffer size and bitrates MP4BitfieldProperty* pBufferSizeProperty; if (m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.bufferSizeDB", (MP4Property**)&pBufferSizeProperty)) { pBufferSizeProperty->SetValue(GetMaxSampleSize()); } MP4Integer32Property* pBitrateProperty; if (m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.maxBitrate", (MP4Property**)&pBitrateProperty)) { pBitrateProperty->SetValue(GetMaxBitrate()); } if (m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate", (MP4Property**)&pBitrateProperty)) { pBitrateProperty->SetValue(GetAvgBitrate()); } } bool MP4Track::IsChunkFull(MP4SampleId sampleId) { if (m_samplesPerChunk) { return m_chunkSamples >= m_samplesPerChunk; } ASSERT(m_durationPerChunk); return m_chunkDuration >= m_durationPerChunk; } u_int32_t MP4Track::GetNumberOfSamples() { return m_pStszSampleCountProperty->GetValue(); } u_int32_t MP4Track::GetSampleSize(MP4SampleId sampleId) { if (m_pStszFixedSampleSizeProperty != NULL) { u_int32_t fixedSampleSize = m_pStszFixedSampleSizeProperty->GetValue(); if (fixedSampleSize != 0) { return fixedSampleSize * m_bytesPerSample; } } // will have to check for 4 bit sample size here if (m_stsz_sample_bits == 4) { uint8_t value = m_pStszSampleSizeProperty->GetValue((sampleId - 1) / 2); if ((sampleId - 1) / 2 == 0) { value >>= 4; } else value &= 0xf; return m_bytesPerSample * value; } return m_bytesPerSample * m_pStszSampleSizeProperty->GetValue(sampleId - 1); } u_int32_t MP4Track::GetMaxSampleSize() { if (m_pStszFixedSampleSizeProperty != NULL) { u_int32_t fixedSampleSize = m_pStszFixedSampleSizeProperty->GetValue(); if (fixedSampleSize != 0) { return fixedSampleSize * m_bytesPerSample; } } u_int32_t maxSampleSize = 0; u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount(); for (MP4SampleId sid = 1; sid <= numSamples; sid++) { u_int32_t sampleSize = m_pStszSampleSizeProperty->GetValue(sid - 1); if (sampleSize > maxSampleSize) { maxSampleSize = sampleSize; } } return maxSampleSize * m_bytesPerSample; } u_int64_t MP4Track::GetTotalOfSampleSizes() { uint64_t retval; if (m_pStszFixedSampleSizeProperty != NULL) { u_int32_t fixedSampleSize = m_pStszFixedSampleSizeProperty->GetValue(); // if fixed sample size, just need to multiply by number of samples if (fixedSampleSize != 0) { retval = m_bytesPerSample; retval *= fixedSampleSize; retval *= GetNumberOfSamples(); return retval; } } // else non-fixed sample size, sum them u_int64_t totalSampleSizes = 0; u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount(); for (MP4SampleId sid = 1; sid <= numSamples; sid++) { u_int32_t sampleSize = m_pStszSampleSizeProperty->GetValue(sid - 1); totalSampleSizes += sampleSize; } return totalSampleSizes * m_bytesPerSample; } void MP4Track::SampleSizePropertyAddValue (uint32_t size) { // this has to deal with different sample size values switch (m_pStszSampleSizeProperty->GetType()) { case Integer32Property: ((MP4Integer32Property *)m_pStszSampleSizeProperty)->AddValue(size); break; case Integer16Property: ((MP4Integer16Property *)m_pStszSampleSizeProperty)->AddValue(size); break; case Integer8Property: if (m_stsz_sample_bits == 4) { if (m_have_stz2_4bit_sample == false) { m_have_stz2_4bit_sample = true; m_stz2_4bit_sample_value = size << 4; return; } else { m_have_stz2_4bit_sample = false; size &= 0xf; size |= m_stz2_4bit_sample_value; } } ((MP4Integer8Property *)m_pStszSampleSizeProperty)->AddValue(size); break; default: break; } // m_pStszSampleSizeProperty->IncrementValue(); } void MP4Track::UpdateSampleSizes(MP4SampleId sampleId, u_int32_t numBytes) { if (m_bytesPerSample > 1) { if ((numBytes % m_bytesPerSample) != 0) { // error VERBOSE_ERROR(m_pFile->GetVerbosity(), printf("UpdateSampleSize: numBytes %u not divisible by bytesPerSample %u sampleId %u\n", numBytes, m_bytesPerSample, sampleId); ); } numBytes /= m_bytesPerSample; } // for first sample // wmay - if we are adding, we want to make sure that // we don't inadvertently set up the fixed size again. // so, we check the number of samples if (sampleId == 1 && GetNumberOfSamples() == 0) { if (m_pStszFixedSampleSizeProperty == NULL || numBytes == 0) { // special case of first sample is zero bytes in length // leave m_pStszFixedSampleSizeProperty at 0 // start recording variable sample sizes if (m_pStszFixedSampleSizeProperty != NULL) m_pStszFixedSampleSizeProperty->SetValue(0); SampleSizePropertyAddValue(0); } else { // presume sample size is fixed m_pStszFixedSampleSizeProperty->SetValue(numBytes); } } else { // sampleId > 1 u_int32_t fixedSampleSize = 0; if (m_pStszFixedSampleSizeProperty != NULL) { fixedSampleSize = m_pStszFixedSampleSizeProperty->GetValue(); } // if we don't have a fixed size, or the current sample size // doesn't match our sample size, we need to write the current // sample size into the table if (fixedSampleSize == 0 || numBytes != fixedSampleSize) { if (fixedSampleSize != 0) { // fixed size was set; we need to clear fixed sample size m_pStszFixedSampleSizeProperty->SetValue(0); // and create sizes for all previous samples // use GetNumberOfSamples due to needing the total number // not just the appended part of the file uint32_t samples = GetNumberOfSamples(); for (MP4SampleId sid = 1; sid <= samples; sid++) { SampleSizePropertyAddValue(fixedSampleSize); } } // add size value for this sample SampleSizePropertyAddValue(numBytes); } } // either way, we increment the number of samples. m_pStszSampleCountProperty->IncrementValue(); #if 0 printf("track %u sample id %u bytes %u fixed %u count %u prop %u\n", m_trackId, sampleId, numBytes, m_pStszFixedSampleSizeProperty->GetValue(), m_pStszSampleSizeProperty->GetCount(), m_pStszSampleCountProperty->GetValue()); #endif } u_int32_t MP4Track::GetAvgBitrate() { if (GetDuration() == 0) { return 0; } double calc = UINT64_TO_DOUBLE(GetTotalOfSampleSizes()); // this is a bit better - we use the whole duration calc *= 8.0; calc *= GetTimeScale(); calc /= UINT64_TO_DOUBLE(GetDuration()); // we might want to think about rounding to the next 100 or 1000 return (uint32_t) ceil(calc); } u_int32_t MP4Track::GetMaxBitrate() { u_int32_t timeScale = GetTimeScale(); MP4SampleId numSamples = GetNumberOfSamples(); u_int32_t maxBytesPerSec = 0; u_int32_t bytesThisSec = 0; MP4Timestamp thisSecStart = 0; MP4Timestamp lastSampleTime = 0; uint32_t lastSampleSize = 0; MP4SampleId thisSecStartSid = 1; for (MP4SampleId sid = 1; sid <= numSamples; sid++) { uint32_t sampleSize; MP4Timestamp sampleTime; sampleSize = GetSampleSize(sid); GetSampleTimes(sid, &sampleTime, NULL); if (sampleTime < thisSecStart + timeScale) { bytesThisSec += sampleSize; lastSampleSize = sampleSize; lastSampleTime = sampleTime; } else { // we've already written the last sample and sampleSize. // this means that we've probably overflowed the last second // calculate the time we've overflowed MP4Duration overflow_dur = (thisSecStart + timeScale) - lastSampleTime; // calculate the duration of the last sample MP4Duration lastSampleDur = sampleTime - lastSampleTime; uint32_t overflow_bytes; // now, calculate the number of bytes we overflowed. Round up. overflow_bytes = ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur; if (bytesThisSec - overflow_bytes > maxBytesPerSec) { maxBytesPerSec = bytesThisSec - overflow_bytes; } // now adjust the values for this sample. Remove the bytes // from the first sample in this time frame lastSampleTime = sampleTime; lastSampleSize = sampleSize; bytesThisSec += sampleSize; bytesThisSec -= GetSampleSize(thisSecStartSid); thisSecStartSid++; GetSampleTimes(thisSecStartSid, &thisSecStart, NULL); } } return maxBytesPerSec * 8; } u_int32_t MP4Track::GetSampleStscIndex(MP4SampleId sampleId) { u_int32_t stscIndex; u_int32_t numStscs = m_pStscCountProperty->GetValue(); if (numStscs == 0) { throw new MP4Error("No data chunks exist", "GetSampleStscIndex"); } for (stscIndex = 0; stscIndex < numStscs; stscIndex++) { if (sampleId < m_pStscFirstSampleProperty->GetValue(stscIndex)) { ASSERT(stscIndex != 0); stscIndex -= 1; break; } } if (stscIndex == numStscs) { ASSERT(stscIndex != 0); stscIndex -= 1; } return stscIndex; } FILE* MP4Track::GetSampleFile(MP4SampleId sampleId) { u_int32_t stscIndex = GetSampleStscIndex(sampleId); u_int32_t stsdIndex = m_pStscSampleDescrIndexProperty->GetValue(stscIndex); // check if the answer will be the same as last time if (m_lastStsdIndex && stsdIndex == m_lastStsdIndex) { return m_lastSampleFile; } MP4Atom* pStsdAtom = m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd"); ASSERT(pStsdAtom); MP4Atom* pStsdEntryAtom = pStsdAtom->GetChildAtom(stsdIndex - 1); ASSERT(pStsdEntryAtom); MP4Integer16Property* pDrefIndexProperty = NULL; if (!pStsdEntryAtom->FindProperty( "*.dataReferenceIndex", (MP4Property**)&pDrefIndexProperty) || pDrefIndexProperty == NULL) { throw new MP4Error("invalid stsd entry", "GetSampleFile"); } u_int32_t drefIndex = pDrefIndexProperty->GetValue(); MP4Atom* pDrefAtom = m_pTrakAtom->FindAtom("trak.mdia.minf.dinf.dref"); ASSERT(pDrefAtom); MP4Atom* pUrlAtom = pDrefAtom->GetChildAtom(drefIndex - 1); ASSERT(pUrlAtom); FILE* pFile; if (pUrlAtom->GetFlags() & 1) { pFile = NULL; // self-contained } else { MP4StringProperty* pLocationProperty = NULL; ASSERT(pUrlAtom->FindProperty( "*.location", (MP4Property**)&pLocationProperty)); ASSERT(pLocationProperty); const char* url = pLocationProperty->GetValue(); VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("dref url = %s\n", url)); pFile = (FILE*)-1; // attempt to open url if it's a file url // currently this is the only thing we understand if (!strncmp(url, "file:", 5)) { const char* fileName = url + 5; if (!strncmp(fileName, "//", 2)) { fileName = strchr(fileName + 2, '/'); } if (fileName) { pFile = fopen(fileName, "rb"); if (!pFile) { pFile = (FILE*)-1; } } } } if (m_lastSampleFile) { fclose(m_lastSampleFile); } // cache the answer m_lastStsdIndex = stsdIndex; m_lastSampleFile = pFile; return pFile; } u_int64_t MP4Track::GetSampleFileOffset(MP4SampleId sampleId) { u_int32_t stscIndex = GetSampleStscIndex(sampleId); // firstChunk is the chunk index of the first chunk with // samplesPerChunk samples in the chunk. There may be multiples - // ie: several chunks with the same number of samples per chunk. u_int32_t firstChunk = m_pStscFirstChunkProperty->GetValue(stscIndex); MP4SampleId firstSample = m_pStscFirstSampleProperty->GetValue(stscIndex); u_int32_t samplesPerChunk = m_pStscSamplesPerChunkProperty->GetValue(stscIndex); // chunkId tells which is the absolute chunk number that this sample // is stored in. MP4ChunkId chunkId = firstChunk + ((sampleId - firstSample) / samplesPerChunk); // chunkOffset is the file offset (absolute) for the start of the chunk u_int64_t chunkOffset = m_pChunkOffsetProperty->GetValue(chunkId - 1); MP4SampleId firstSampleInChunk = sampleId - ((sampleId - firstSample) % samplesPerChunk); // need cumulative samples sizes from firstSample to sampleId - 1 u_int32_t sampleOffset = 0; for (MP4SampleId i = firstSampleInChunk; i < sampleId; i++) { sampleOffset += GetSampleSize(i); } return chunkOffset + sampleOffset; } void MP4Track::UpdateSampleToChunk(MP4SampleId sampleId, MP4ChunkId chunkId, u_int32_t samplesPerChunk) { u_int32_t numStsc = m_pStscCountProperty->GetValue(); // if samplesPerChunk == samplesPerChunk of last entry if (numStsc && samplesPerChunk == m_pStscSamplesPerChunkProperty->GetValue(numStsc-1)) { // nothing to do } else { // add stsc entry m_pStscFirstChunkProperty->AddValue(chunkId); m_pStscSamplesPerChunkProperty->AddValue(samplesPerChunk); m_pStscSampleDescrIndexProperty->AddValue(1); m_pStscFirstSampleProperty->AddValue(sampleId - samplesPerChunk + 1); m_pStscCountProperty->IncrementValue(); } } void MP4Track::UpdateChunkOffsets(u_int64_t chunkOffset) { if (m_pChunkOffsetProperty->GetType() == Integer32Property) { ((MP4Integer32Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset); } else { ((MP4Integer64Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset); } m_pChunkCountProperty->IncrementValue(); } MP4Duration MP4Track::GetFixedSampleDuration() { u_int32_t numStts = m_pSttsCountProperty->GetValue(); if (numStts == 0) { return m_fixedSampleDuration; } if (numStts != 1) { return MP4_INVALID_DURATION; // sample duration is not fixed } return m_pSttsSampleDeltaProperty->GetValue(0); } void MP4Track::SetFixedSampleDuration(MP4Duration duration) { u_int32_t numStts = m_pSttsCountProperty->GetValue(); // setting this is only allowed before samples have been written if (numStts != 0) { return; } m_fixedSampleDuration = duration; return; } void MP4Track::GetSampleTimes(MP4SampleId sampleId, MP4Timestamp* pStartTime, MP4Duration* pDuration) { u_int32_t numStts = m_pSttsCountProperty->GetValue(); MP4SampleId sid; MP4Duration elapsed; if (m_cachedSttsSid != MP4_INVALID_SAMPLE_ID && sampleId >= m_cachedSttsSid) { sid = m_cachedSttsSid; elapsed = m_cachedSttsElapsed; } else { m_cachedSttsIndex = 0; sid = 1; elapsed = 0; } for (u_int32_t sttsIndex = m_cachedSttsIndex; sttsIndex < numStts; sttsIndex++) { u_int32_t sampleCount = m_pSttsSampleCountProperty->GetValue(sttsIndex); u_int32_t sampleDelta = m_pSttsSampleDeltaProperty->GetValue(sttsIndex); if (sampleId <= sid + sampleCount - 1) { if (pStartTime) { *pStartTime = (sampleId - sid); *pStartTime *= sampleDelta; *pStartTime += elapsed; } if (pDuration) { *pDuration = sampleDelta; } m_cachedSttsIndex = sttsIndex; m_cachedSttsSid = sid; m_cachedSttsElapsed = elapsed; return; } sid += sampleCount; elapsed += sampleCount * sampleDelta; } throw new MP4Error("sample id out of range", "MP4Track::GetSampleTimes"); } MP4SampleId MP4Track::GetSampleIdFromTime( MP4Timestamp when, bool wantSyncSample) { u_int32_t numStts = m_pSttsCountProperty->GetValue(); MP4SampleId sid = 1; MP4Duration elapsed = 0; for (u_int32_t sttsIndex = 0; sttsIndex < numStts; sttsIndex++) { u_int32_t sampleCount = m_pSttsSampleCountProperty->GetValue(sttsIndex); u_int32_t sampleDelta = m_pSttsSampleDeltaProperty->GetValue(sttsIndex); if (sampleDelta == 0 && sttsIndex < numStts - 1) { VERBOSE_READ(m_pFile->GetVerbosity(), printf("Warning: Zero sample duration, stts entry %u\n", sttsIndex)); } MP4Duration d = when - elapsed; if (d <= sampleCount * sampleDelta) { MP4SampleId sampleId = sid; if (sampleDelta) { sampleId += (d / sampleDelta); } if (wantSyncSample) { return GetNextSyncSample(sampleId); } return sampleId; } sid += sampleCount; elapsed += sampleCount * sampleDelta; } throw new MP4Error("time out of range", "MP4Track::GetSampleIdFromTime"); return 0; // satisfy MS compiler } void MP4Track::UpdateSampleTimes(MP4Duration duration) { u_int32_t numStts = m_pSttsCountProperty->GetValue(); // if duration == duration of last entry if (numStts && duration == m_pSttsSampleDeltaProperty->GetValue(numStts-1)) { // increment last entry sampleCount m_pSttsSampleCountProperty->IncrementValue(1, numStts-1); } else { // add stts entry, sampleCount = 1, sampleDuration = duration m_pSttsSampleCountProperty->AddValue(1); m_pSttsSampleDeltaProperty->AddValue(duration); m_pSttsCountProperty->IncrementValue();; } } u_int32_t MP4Track::GetSampleCttsIndex(MP4SampleId sampleId, MP4SampleId* pFirstSampleId) { u_int32_t numCtts = m_pCttsCountProperty->GetValue(); MP4SampleId sid = 1; for (u_int32_t cttsIndex = 0; cttsIndex < numCtts; cttsIndex++) { u_int32_t sampleCount = m_pCttsSampleCountProperty->GetValue(cttsIndex); if (sampleId <= sid + sampleCount - 1) { if (pFirstSampleId) { *pFirstSampleId = sid; } return cttsIndex; } sid += sampleCount; } throw new MP4Error("sample id out of range", "MP4Track::GetSampleCttsIndex"); return 0; // satisfy MS compiler } MP4Duration MP4Track::GetSampleRenderingOffset(MP4SampleId sampleId) { if (m_pCttsCountProperty == NULL) { return 0; } if (m_pCttsCountProperty->GetValue() == 0) { return 0; } u_int32_t cttsIndex = GetSampleCttsIndex(sampleId); return m_pCttsSampleOffsetProperty->GetValue(cttsIndex); } void MP4Track::UpdateRenderingOffsets(MP4SampleId sampleId, MP4Duration renderingOffset) { // if ctts atom doesn't exist if (m_pCttsCountProperty == NULL) { // no rendering offset, so nothing to do if (renderingOffset == 0) { return; } // else create a ctts atom MP4Atom* pCttsAtom = AddAtom("trak.mdia.minf.stbl", "ctts"); // and get handles on the properties ASSERT(pCttsAtom->FindProperty( "ctts.entryCount", (MP4Property**)&m_pCttsCountProperty)); ASSERT(pCttsAtom->FindProperty( "ctts.entries.sampleCount", (MP4Property**)&m_pCttsSampleCountProperty)); ASSERT(pCttsAtom->FindProperty( "ctts.entries.sampleOffset", (MP4Property**)&m_pCttsSampleOffsetProperty)); // if this is not the first sample if (sampleId > 1) { // add a ctts entry for all previous samples // with rendering offset equal to zero m_pCttsSampleCountProperty->AddValue(sampleId - 1); m_pCttsSampleOffsetProperty->AddValue(0); m_pCttsCountProperty->IncrementValue();; } } // ctts atom exists (now) u_int32_t numCtts = m_pCttsCountProperty->GetValue(); // if renderingOffset == renderingOffset of last entry if (numCtts && renderingOffset == m_pCttsSampleOffsetProperty->GetValue(numCtts-1)) { // increment last entry sampleCount m_pCttsSampleCountProperty->IncrementValue(1, numCtts-1); } else { // add ctts entry, sampleCount = 1, sampleOffset = renderingOffset m_pCttsSampleCountProperty->AddValue(1); m_pCttsSampleOffsetProperty->AddValue(renderingOffset); m_pCttsCountProperty->IncrementValue(); } } void MP4Track::SetSampleRenderingOffset(MP4SampleId sampleId, MP4Duration renderingOffset) { // check if any ctts entries exist if (m_pCttsCountProperty == NULL || m_pCttsCountProperty->GetValue() == 0) { // if not then Update routine can be used // to create a ctts entry for samples before this one // and a ctts entry for this sample UpdateRenderingOffsets(sampleId, renderingOffset); // but we also need a ctts entry // for all samples after this one u_int32_t afterSamples = GetNumberOfSamples() - sampleId; if (afterSamples) { m_pCttsSampleCountProperty->AddValue(afterSamples); m_pCttsSampleOffsetProperty->AddValue(0); m_pCttsCountProperty->IncrementValue();; } return; } MP4SampleId firstSampleId; u_int32_t cttsIndex = GetSampleCttsIndex(sampleId, &firstSampleId); // do nothing in the degenerate case if (renderingOffset == m_pCttsSampleOffsetProperty->GetValue(cttsIndex)) { return; } u_int32_t sampleCount = m_pCttsSampleCountProperty->GetValue(cttsIndex); // if this sample has it's own ctts entry if (sampleCount == 1) { // then just set the value, // note we don't attempt to collapse entries m_pCttsSampleOffsetProperty->SetValue(renderingOffset, cttsIndex); return; } MP4SampleId lastSampleId = firstSampleId + sampleCount - 1; // else we share this entry with other samples // we need to insert our own entry if (sampleId == firstSampleId) { // our sample is the first one m_pCttsSampleCountProperty-> InsertValue(1, cttsIndex); m_pCttsSampleOffsetProperty-> InsertValue(renderingOffset, cttsIndex); m_pCttsSampleCountProperty-> SetValue(sampleCount - 1, cttsIndex + 1); m_pCttsCountProperty->IncrementValue(); } else if (sampleId == lastSampleId) { // our sample is the last one m_pCttsSampleCountProperty-> InsertValue(1, cttsIndex + 1); m_pCttsSampleOffsetProperty-> InsertValue(renderingOffset, cttsIndex + 1); m_pCttsSampleCountProperty-> SetValue(sampleCount - 1, cttsIndex); m_pCttsCountProperty->IncrementValue(); } else { // our sample is in the middle, UGH! // insert our new entry m_pCttsSampleCountProperty-> InsertValue(1, cttsIndex + 1); m_pCttsSampleOffsetProperty-> InsertValue(renderingOffset, cttsIndex + 1); // adjust count of previous entry m_pCttsSampleCountProperty-> SetValue(sampleId - firstSampleId, cttsIndex); // insert new entry for those samples beyond our sample m_pCttsSampleCountProperty-> InsertValue(lastSampleId - sampleId, cttsIndex + 2); u_int32_t oldRenderingOffset = m_pCttsSampleOffsetProperty->GetValue(cttsIndex); m_pCttsSampleOffsetProperty-> InsertValue(oldRenderingOffset, cttsIndex + 2); m_pCttsCountProperty->IncrementValue(2); } } bool MP4Track::IsSyncSample(MP4SampleId sampleId) { if (m_pStssCountProperty == NULL) { return true; } u_int32_t numStss = m_pStssCountProperty->GetValue(); u_int32_t stssLIndex = 0; u_int32_t stssRIndex = numStss - 1; while (stssRIndex >= stssLIndex){ u_int32_t stssIndex = (stssRIndex + stssLIndex) >> 1; MP4SampleId syncSampleId = m_pStssSampleProperty->GetValue(stssIndex); if (sampleId == syncSampleId) { return true; } if (sampleId > syncSampleId) { stssLIndex = stssIndex + 1; } else { stssRIndex = stssIndex - 1; } } return false; } // N.B. "next" is inclusive of this sample id MP4SampleId MP4Track::GetNextSyncSample(MP4SampleId sampleId) { if (m_pStssCountProperty == NULL) { return sampleId; } u_int32_t numStss = m_pStssCountProperty->GetValue(); for (u_int32_t stssIndex = 0; stssIndex < numStss; stssIndex++) { MP4SampleId syncSampleId = m_pStssSampleProperty->GetValue(stssIndex); if (sampleId > syncSampleId) { continue; } return syncSampleId; } // LATER check stsh for alternate sample return MP4_INVALID_SAMPLE_ID; } void MP4Track::UpdateSyncSamples(MP4SampleId sampleId, bool isSyncSample) { if (isSyncSample) { // if stss atom exists, add entry if (m_pStssCountProperty) { m_pStssSampleProperty->AddValue(sampleId); m_pStssCountProperty->IncrementValue(); } // else nothing to do (yet) } else { // !isSyncSample // if stss atom doesn't exist, create one if (m_pStssCountProperty == NULL) { MP4Atom* pStssAtom = AddAtom("trak.mdia.minf.stbl", "stss"); ASSERT(pStssAtom->FindProperty( "stss.entryCount", (MP4Property**)&m_pStssCountProperty)); ASSERT(pStssAtom->FindProperty( "stss.entries.sampleNumber", (MP4Property**)&m_pStssSampleProperty)); // set values for all samples that came before this one uint32_t samples = GetNumberOfSamples(); for (MP4SampleId sid = 1; sid < samples; sid++) { m_pStssSampleProperty->AddValue(sid); m_pStssCountProperty->IncrementValue(); } } // else nothing to do } } MP4Atom* MP4Track::AddAtom(char* parentName, char* childName) { MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName); MP4Atom* pParentAtom = m_pTrakAtom->FindAtom(parentName); ASSERT(pParentAtom); pParentAtom->AddChildAtom(pChildAtom); pChildAtom->Generate(); return pChildAtom; } u_int64_t MP4Track::GetDuration() { return m_pMediaDurationProperty->GetValue(); } u_int32_t MP4Track::GetTimeScale() { return m_pTimeScaleProperty->GetValue(); } void MP4Track::UpdateDurations(MP4Duration duration) { // update media, track, and movie durations m_pMediaDurationProperty->SetValue( m_pMediaDurationProperty->GetValue() + duration); MP4Duration movieDuration = ToMovieDuration(duration); m_pTrackDurationProperty->SetValue( m_pTrackDurationProperty->GetValue() + movieDuration); m_pFile->UpdateDuration(m_pTrackDurationProperty->GetValue()); } MP4Duration MP4Track::ToMovieDuration(MP4Duration trackDuration) { return (trackDuration * m_pFile->GetTimeScale()) / m_pTimeScaleProperty->GetValue(); } void MP4Track::UpdateModificationTimes() { // update media and track modification times MP4Timestamp now = MP4GetAbsTimestamp(); m_pMediaModificationProperty->SetValue(now); m_pTrackModificationProperty->SetValue(now); } u_int32_t MP4Track::GetNumberOfChunks() { return m_pChunkOffsetProperty->GetCount(); } u_int32_t MP4Track::GetChunkStscIndex(MP4ChunkId chunkId) { u_int32_t stscIndex; u_int32_t numStscs = m_pStscCountProperty->GetValue(); ASSERT(chunkId); ASSERT(numStscs > 0); for (stscIndex = 0; stscIndex < numStscs; stscIndex++) { if (chunkId < m_pStscFirstChunkProperty->GetValue(stscIndex)) { ASSERT(stscIndex != 0); break; } } return stscIndex - 1; } MP4Timestamp MP4Track::GetChunkTime(MP4ChunkId chunkId) { u_int32_t stscIndex = GetChunkStscIndex(chunkId); MP4ChunkId firstChunkId = m_pStscFirstChunkProperty->GetValue(stscIndex); MP4SampleId firstSample = m_pStscFirstSampleProperty->GetValue(stscIndex); u_int32_t samplesPerChunk = m_pStscSamplesPerChunkProperty->GetValue(stscIndex); MP4SampleId firstSampleInChunk = firstSample + ((chunkId - firstChunkId) * samplesPerChunk); MP4Timestamp chunkTime; GetSampleTimes(firstSampleInChunk, &chunkTime, NULL); return chunkTime; } u_int32_t MP4Track::GetChunkSize(MP4ChunkId chunkId) { u_int32_t stscIndex = GetChunkStscIndex(chunkId); MP4ChunkId firstChunkId = m_pStscFirstChunkProperty->GetValue(stscIndex); MP4SampleId firstSample = m_pStscFirstSampleProperty->GetValue(stscIndex); u_int32_t samplesPerChunk = m_pStscSamplesPerChunkProperty->GetValue(stscIndex); MP4SampleId firstSampleInChunk = firstSample + ((chunkId - firstChunkId) * samplesPerChunk); // need cumulative sizes of samples in chunk u_int32_t chunkSize = 0; for (u_int32_t i = 0; i < samplesPerChunk; i++) { chunkSize += GetSampleSize(firstSampleInChunk + i); } return chunkSize; } void MP4Track::ReadChunk(MP4ChunkId chunkId, u_int8_t** ppChunk, u_int32_t* pChunkSize) { ASSERT(chunkId); ASSERT(ppChunk); ASSERT(pChunkSize); u_int64_t chunkOffset = m_pChunkOffsetProperty->GetValue(chunkId - 1); *pChunkSize = GetChunkSize(chunkId); *ppChunk = (u_int8_t*)MP4Malloc(*pChunkSize); VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), printf("ReadChunk: track %u id %u offset 0x"X64" size %u (0x%x)\n", m_trackId, chunkId, chunkOffset, *pChunkSize, *pChunkSize)); u_int64_t oldPos = m_pFile->GetPosition(); // only used in mode == 'w' try { m_pFile->SetPosition(chunkOffset); m_pFile->ReadBytes(*ppChunk, *pChunkSize); } catch (MP4Error* e) { // let's not leak memory MP4Free(*ppChunk); *ppChunk = NULL; if (m_pFile->GetMode() == 'w') { m_pFile->SetPosition(oldPos); } throw e; } if (m_pFile->GetMode() == 'w') { m_pFile->SetPosition(oldPos); } } void MP4Track::RewriteChunk(MP4ChunkId chunkId, u_int8_t* pChunk, u_int32_t chunkSize) { u_int64_t chunkOffset = m_pFile->GetPosition(); m_pFile->WriteBytes(pChunk, chunkSize); m_pChunkOffsetProperty->SetValue(chunkOffset, chunkId - 1); VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), printf("RewriteChunk: track %u id %u offset 0x"X64" size %u (0x%x)\n", m_trackId, chunkId, chunkOffset, chunkSize, chunkSize)); } // map track type name aliases to official names bool MP4Track::InitEditListProperties() { m_pElstCountProperty = NULL; m_pElstMediaTimeProperty = NULL; m_pElstDurationProperty = NULL; m_pElstRateProperty = NULL; m_pElstReservedProperty = NULL; MP4Atom* pElstAtom = m_pTrakAtom->FindAtom("trak.edts.elst"); if (!pElstAtom) { return false; } (void)pElstAtom->FindProperty( "elst.entryCount", (MP4Property**)&m_pElstCountProperty); (void)pElstAtom->FindProperty( "elst.entries.mediaTime", (MP4Property**)&m_pElstMediaTimeProperty); (void)pElstAtom->FindProperty( "elst.entries.segmentDuration", (MP4Property**)&m_pElstDurationProperty); (void)pElstAtom->FindProperty( "elst.entries.mediaRate", (MP4Property**)&m_pElstRateProperty); (void)pElstAtom->FindProperty( "elst.entries.reserved", (MP4Property**)&m_pElstReservedProperty); return m_pElstCountProperty && m_pElstMediaTimeProperty && m_pElstDurationProperty && m_pElstRateProperty && m_pElstReservedProperty; } MP4EditId MP4Track::AddEdit(MP4EditId editId) { if (!m_pElstCountProperty) { (void)m_pFile->AddDescendantAtoms(m_pTrakAtom, "edts.elst"); if (InitEditListProperties() == false) return MP4_INVALID_EDIT_ID; } if (editId == MP4_INVALID_EDIT_ID) { editId = m_pElstCountProperty->GetValue() + 1; } m_pElstMediaTimeProperty->InsertValue(0, editId - 1); m_pElstDurationProperty->InsertValue(0, editId - 1); m_pElstRateProperty->InsertValue(1, editId - 1); m_pElstReservedProperty->InsertValue(0, editId - 1); m_pElstCountProperty->IncrementValue(); return editId; } void MP4Track::DeleteEdit(MP4EditId editId) { if (editId == MP4_INVALID_EDIT_ID) { throw new MP4Error("edit id can't be zero", "MP4Track::DeleteEdit"); } if (!m_pElstCountProperty || m_pElstCountProperty->GetValue() == 0) { throw new MP4Error("no edits exist", "MP4Track::DeleteEdit"); } m_pElstMediaTimeProperty->DeleteValue(editId - 1); m_pElstDurationProperty->DeleteValue(editId - 1); m_pElstRateProperty->DeleteValue(editId - 1); m_pElstReservedProperty->DeleteValue(editId - 1); m_pElstCountProperty->IncrementValue(-1); // clean up if last edit is deleted if (m_pElstCountProperty->GetValue() == 0) { m_pElstCountProperty = NULL; m_pElstMediaTimeProperty = NULL; m_pElstDurationProperty = NULL; m_pElstRateProperty = NULL; m_pElstReservedProperty = NULL; m_pTrakAtom->DeleteChildAtom( m_pTrakAtom->FindAtom("trak.edts")); } } MP4Timestamp MP4Track::GetEditStart( MP4EditId editId) { if (editId == MP4_INVALID_EDIT_ID) { return MP4_INVALID_TIMESTAMP; } else if (editId == 1) { return 0; } return (MP4Timestamp)GetEditTotalDuration(editId - 1); } MP4Duration MP4Track::GetEditTotalDuration( MP4EditId editId) { u_int32_t numEdits = 0; if (m_pElstCountProperty) { numEdits = m_pElstCountProperty->GetValue(); } if (editId == MP4_INVALID_EDIT_ID) { editId = numEdits; } if (numEdits == 0 || editId > numEdits) { return MP4_INVALID_DURATION; } MP4Duration totalDuration = 0; for (MP4EditId eid = 1; eid <= editId; eid++) { totalDuration += m_pElstDurationProperty->GetValue(eid - 1); } return totalDuration; } MP4SampleId MP4Track::GetSampleIdFromEditTime( MP4Timestamp editWhen, MP4Timestamp* pStartTime, MP4Duration* pDuration) { MP4SampleId sampleId = MP4_INVALID_SAMPLE_ID; u_int32_t numEdits = 0; if (m_pElstCountProperty) { numEdits = m_pElstCountProperty->GetValue(); } if (numEdits) { MP4Duration editElapsedDuration = 0; for (MP4EditId editId = 1; editId <= numEdits; editId++) { // remember edit segment's start time (in edit timeline) MP4Timestamp editStartTime = (MP4Timestamp)editElapsedDuration; // accumulate edit segment's duration editElapsedDuration += m_pElstDurationProperty->GetValue(editId - 1); // calculate difference between the specified edit time // and the end of this edit segment if (editElapsedDuration - editWhen <= 0) { // the specified time has not yet been reached continue; } // 'editWhen' is within this edit segment // calculate the specified edit time // relative to just this edit segment MP4Duration editOffset = editWhen - editStartTime; // calculate the media (track) time that corresponds // to the specified edit time based on the edit list MP4Timestamp mediaWhen = m_pElstMediaTimeProperty->GetValue(editId - 1) + editOffset; // lookup the sample id for the media time sampleId = GetSampleIdFromTime(mediaWhen, false); // lookup the sample's media start time and duration MP4Timestamp sampleStartTime; MP4Duration sampleDuration; GetSampleTimes(sampleId, &sampleStartTime, &sampleDuration); // calculate the difference if any between when the sample // would naturally start and when it starts in the edit timeline MP4Duration sampleStartOffset = mediaWhen - sampleStartTime; // calculate the start time for the sample in the edit time line MP4Timestamp editSampleStartTime = editWhen - MIN(editOffset, sampleStartOffset); MP4Duration editSampleDuration = 0; // calculate how long this sample lasts in the edit list timeline if (m_pElstRateProperty->GetValue(editId - 1) == 0) { // edit segment is a "dwell" // so sample duration is that of the edit segment editSampleDuration = m_pElstDurationProperty->GetValue(editId - 1); } else { // begin with the natural sample duration editSampleDuration = sampleDuration; // now shorten that if the edit segment starts // after the sample would naturally start if (editOffset < sampleStartOffset) { editSampleDuration -= sampleStartOffset - editOffset; } // now shorten that if the edit segment ends // before the sample would naturally end if (editElapsedDuration < editSampleStartTime + sampleDuration) { editSampleDuration -= (editSampleStartTime + sampleDuration) - editElapsedDuration; } } if (pStartTime) { *pStartTime = editSampleStartTime; } if (pDuration) { *pDuration = editSampleDuration; } VERBOSE_EDIT(m_pFile->GetVerbosity(), printf("GetSampleIdFromEditTime: when "U64" " "sampleId %u start "U64" duration "D64"\n", editWhen, sampleId, editSampleStartTime, editSampleDuration)); return sampleId; } throw new MP4Error("time out of range", "MP4Track::GetSampleIdFromEditTime"); } else { // no edit list sampleId = GetSampleIdFromTime(editWhen, false); if (pStartTime || pDuration) { GetSampleTimes(sampleId, pStartTime, pDuration); } } return sampleId; } void MP4Track::CalculateBytesPerSample () { MP4Atom *pMedia = m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd"); MP4Atom *pMediaData; const char *media_data_name; if (pMedia == NULL) return; if (pMedia->GetNumberOfChildAtoms() != 1) return; pMediaData = pMedia->GetChildAtom(0); media_data_name = pMediaData->GetType(); if ((ATOMID(media_data_name) == ATOMID("twos")) || (ATOMID(media_data_name) == ATOMID("sowt"))) { MP4IntegerProperty *chan, *sampleSize; chan = (MP4IntegerProperty *)pMediaData->GetProperty(4); sampleSize = (MP4IntegerProperty *)pMediaData->GetProperty(5); m_bytesPerSample = chan->GetValue() * (sampleSize->GetValue() / 8); } } faac-1.28/common/mp4v2/mp4track.h0000644010307701030770000001663011136736372020221 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. * * Portions created by Ximpo Group Ltd. are * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com */ #ifndef __MP4_TRACK_INCLUDED__ #define __MP4_TRACK_INCLUDED__ typedef u_int32_t MP4ChunkId; // forward declarations class MP4File; class MP4Atom; class MP4Property; class MP4IntegerProperty; class MP4Integer16Property; class MP4Integer32Property; class MP4Integer64Property; class MP4StringProperty; class MP4Track { public: MP4Track(MP4File* pFile, MP4Atom* pTrakAtom); virtual ~MP4Track(); MP4TrackId GetId() { return m_trackId; } const char* GetType(); void SetType(const char* type); MP4File* GetFile() { return m_pFile; } MP4Atom* GetTrakAtom() { return m_pTrakAtom; } void ReadSample( // input parameters MP4SampleId sampleId, // output parameters u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime = NULL, MP4Duration* pDuration = NULL, MP4Duration* pRenderingOffset = NULL, bool* pIsSyncSample = NULL); void WriteSample( const u_int8_t* pBytes, u_int32_t numBytes, MP4Duration duration = 0, MP4Duration renderingOffset = 0, bool isSyncSample = true); virtual void FinishWrite(); u_int64_t GetDuration(); // in track timeScale units u_int32_t GetTimeScale(); u_int32_t GetNumberOfSamples(); u_int32_t GetSampleSize(MP4SampleId sampleId); u_int32_t GetMaxSampleSize(); u_int64_t GetTotalOfSampleSizes(); u_int32_t GetAvgBitrate(); // in bps u_int32_t GetMaxBitrate(); // in bps MP4Duration GetFixedSampleDuration(); void SetFixedSampleDuration(MP4Duration duration); void GetSampleTimes(MP4SampleId sampleId, MP4Timestamp* pStartTime, MP4Duration* pDuration); bool IsSyncSample(MP4SampleId sampleId); MP4SampleId GetSampleIdFromTime( MP4Timestamp when, bool wantSyncSample = false); MP4Duration GetSampleRenderingOffset(MP4SampleId sampleId); void SetSampleRenderingOffset(MP4SampleId sampleId, MP4Duration renderingOffset); MP4EditId AddEdit( MP4EditId editId = MP4_INVALID_EDIT_ID); void DeleteEdit( MP4EditId editId); MP4Timestamp GetEditStart( MP4EditId editId); MP4Timestamp GetEditTotalDuration( MP4EditId editId); MP4SampleId GetSampleIdFromEditTime( MP4Timestamp editWhen, MP4Timestamp* pStartTime = NULL, MP4Duration* pDuration = NULL); // special operation for use during hint track packet assembly void ReadSampleFragment( MP4SampleId sampleId, u_int32_t sampleOffset, u_int16_t sampleLength, u_int8_t* pDest); // special operations for use during optimization u_int32_t GetNumberOfChunks(); MP4Timestamp GetChunkTime(MP4ChunkId chunkId); void ReadChunk(MP4ChunkId chunkId, u_int8_t** ppChunk, u_int32_t* pChunkSize); void RewriteChunk(MP4ChunkId chunkId, u_int8_t* pChunk, u_int32_t chunkSize); protected: bool InitEditListProperties(); FILE* GetSampleFile(MP4SampleId sampleId); u_int64_t GetSampleFileOffset(MP4SampleId sampleId); u_int32_t GetSampleStscIndex(MP4SampleId sampleId); u_int32_t GetChunkStscIndex(MP4ChunkId chunkId); u_int32_t GetChunkSize(MP4ChunkId chunkId); u_int32_t GetSampleCttsIndex(MP4SampleId sampleId, MP4SampleId* pFirstSampleId = NULL); MP4SampleId GetNextSyncSample(MP4SampleId sampleId); void UpdateSampleSizes(MP4SampleId sampleId, u_int32_t numBytes); bool IsChunkFull(MP4SampleId sampleId); void UpdateSampleToChunk(MP4SampleId sampleId, MP4ChunkId chunkId, u_int32_t samplesPerChunk); void UpdateChunkOffsets(u_int64_t chunkOffset); void UpdateSampleTimes(MP4Duration duration); void UpdateRenderingOffsets(MP4SampleId sampleId, MP4Duration renderingOffset); void UpdateSyncSamples(MP4SampleId sampleId, bool isSyncSample); MP4Atom* AddAtom(char* parentName, char* childName); void UpdateDurations(MP4Duration duration); MP4Duration ToMovieDuration(MP4Duration trackDuration); void UpdateModificationTimes(); void WriteChunkBuffer(); void CalculateBytesPerSample(); protected: MP4File* m_pFile; MP4Atom* m_pTrakAtom; // moov.trak[] MP4TrackId m_trackId; // moov.trak[].tkhd.trackId MP4StringProperty* m_pTypeProperty; // moov.trak[].mdia.hdlr.handlerType u_int32_t m_lastStsdIndex; FILE* m_lastSampleFile; // for efficient construction of hint track packets MP4SampleId m_cachedReadSampleId; u_int8_t* m_pCachedReadSample; u_int32_t m_cachedReadSampleSize; // for writing MP4SampleId m_writeSampleId; MP4Duration m_fixedSampleDuration; u_int8_t* m_pChunkBuffer; u_int32_t m_chunkBufferSize; u_int32_t m_chunkSamples; MP4Duration m_chunkDuration; // controls for chunking u_int32_t m_samplesPerChunk; MP4Duration m_durationPerChunk; u_int32_t m_bytesPerSample; // controls for AMR chunking int m_isAmr; u_int8_t m_curMode; MP4Integer32Property* m_pTimeScaleProperty; MP4IntegerProperty* m_pTrackDurationProperty; // 32 or 64 bits MP4IntegerProperty* m_pMediaDurationProperty; // 32 or 64 bits MP4IntegerProperty* m_pTrackModificationProperty; // 32 or 64 bits MP4IntegerProperty* m_pMediaModificationProperty; // 32 or 64 bits MP4Integer32Property* m_pStszFixedSampleSizeProperty; MP4Integer32Property* m_pStszSampleCountProperty; void SampleSizePropertyAddValue(uint32_t bytes); uint8_t m_stsz_sample_bits; bool m_have_stz2_4bit_sample; uint8_t m_stz2_4bit_sample_value; MP4IntegerProperty* m_pStszSampleSizeProperty; MP4Integer32Property* m_pStscCountProperty; MP4Integer32Property* m_pStscFirstChunkProperty; MP4Integer32Property* m_pStscSamplesPerChunkProperty; MP4Integer32Property* m_pStscSampleDescrIndexProperty; MP4Integer32Property* m_pStscFirstSampleProperty; MP4Integer32Property* m_pChunkCountProperty; MP4IntegerProperty* m_pChunkOffsetProperty; // 32 or 64 bits MP4Integer32Property* m_pSttsCountProperty; MP4Integer32Property* m_pSttsSampleCountProperty; MP4Integer32Property* m_pSttsSampleDeltaProperty; // for improve sequental timestamp index access u_int32_t m_cachedSttsIndex; MP4SampleId m_cachedSttsSid; MP4Timestamp m_cachedSttsElapsed; MP4Integer32Property* m_pCttsCountProperty; MP4Integer32Property* m_pCttsSampleCountProperty; MP4Integer32Property* m_pCttsSampleOffsetProperty; MP4Integer32Property* m_pStssCountProperty; MP4Integer32Property* m_pStssSampleProperty; MP4Integer32Property* m_pElstCountProperty; MP4IntegerProperty* m_pElstMediaTimeProperty; // 32 or 64 bits MP4IntegerProperty* m_pElstDurationProperty; // 32 or 64 bits MP4Integer16Property* m_pElstRateProperty; MP4Integer16Property* m_pElstReservedProperty; }; MP4ARRAY_DECL(MP4Track, MP4Track*); #endif /* __MP4_TRACK_INCLUDED__ */ faac-1.28/common/mp4v2/mp4util.cpp0000644010307701030770000002073711136736372020430 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001-2005. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Bill May wmay@cisco.com */ #include "mp4common.h" static lib_message_func_t libfunc = NULL; extern "C" void MP4SetLibFunc(lib_message_func_t libf) { libfunc = libf; } void MP4Error::Print(FILE* pFile) { if (libfunc != NULL) { (libfunc)(LOG_ERR, "MP4ERROR", "%s:%s:%s", m_where == NULL ? "" : m_where, m_errstring == NULL ? "" : m_errstring, m_errno ? strerror(m_errno) : ""); return; } fprintf(pFile, "MP4ERROR: "); if (m_where) { fprintf(pFile, "%s", m_where); } if (m_errstring) { if (m_where) { fprintf(pFile, ": "); } fprintf(pFile, "%s", m_errstring); } if (m_errno) { if (m_where || m_errstring) { fprintf(pFile, ": "); } fprintf(pFile, "%s", strerror(m_errno)); } fprintf(pFile, "\n"); } void MP4HexDump( u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile, u_int8_t indent) { if (pFile == NULL) { pFile = stdout; } Indent(pFile, indent); fprintf(pFile, "<%u bytes> ", numBytes); for (u_int32_t i = 0; i < numBytes; i++) { if ((i % 16) == 0 && numBytes > 16) { fprintf(pFile, "\n"); Indent(pFile, indent); } fprintf(pFile, "%02x ", pBytes[i]); } fprintf(pFile, "\n"); } bool MP4NameFirstMatches(const char* s1, const char* s2) { if (s1 == NULL || *s1 == '\0' || s2 == NULL || *s2 == '\0') { return false; } if (*s2 == '*') { return true; } while (*s1 != '\0') { if (*s2 == '\0' || strchr("[.", *s2)) { break; } if (tolower(*s1) != tolower(*s2)) { return false; } s1++; s2++; } return true; } bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex) { if (s == NULL) { return false; } while (*s != '\0' && *s != '.') { if (*s == '[') { s++; ASSERT(pIndex); if (sscanf(s, "%u", pIndex) != 1) { return false; } return true; } s++; } return false; } char* MP4NameFirst(const char *s) { if (s == NULL) { return NULL; } const char* end = s; while (*end != '\0' && *end != '.') { end++; } char* first = (char*)MP4Calloc((end - s) + 1); if (first) { strncpy(first, s, end - s); } return first; } const char* MP4NameAfterFirst(const char *s) { if (s == NULL) { return NULL; } while (*s != '\0') { if (*s == '.') { s++; if (*s == '\0') { return NULL; } return s; } s++; } return NULL; } char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize) { if (dataSize) { ASSERT(pData); } uint size = 2 * dataSize + 1; char* s = (char*)MP4Calloc(size); u_int32_t i, j; for (i = 0, j = 0; i < dataSize; i++) { size -= snprintf(&s[j], size, "%02x", pData[i]); j += 2; } return s; /* N.B. caller is responsible for free'ing s */ } char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize) { if (pData == NULL || dataSize == 0) return NULL; static const char encoding[64] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; char* s = (char*)MP4Calloc((((dataSize + 2) * 4) / 3) + 1); const u_int8_t* src = pData; if (pData == NULL) return NULL; char* dest = s; u_int32_t numGroups = dataSize / 3; for (u_int32_t i = 0; i < numGroups; i++) { *dest++ = encoding[src[0] >> 2]; *dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)]; *dest++ = encoding[((src[1] & 0x0F) << 2) | (src[2] >> 6)]; *dest++ = encoding[src[2] & 0x3F]; src += 3; } if (dataSize % 3 == 1) { *dest++ = encoding[src[0] >> 2]; *dest++ = encoding[((src[0] & 0x03) << 4)]; *dest++ = '='; *dest++ = '='; } else if (dataSize % 3 == 2) { *dest++ = encoding[src[0] >> 2]; *dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)]; *dest++ = encoding[((src[1] & 0x0F) << 2)]; *dest++ = '='; } *dest = '\0'; return s; /* N.B. caller is responsible for free'ing s */ } static bool convertBase64 (const char data, uint8_t *value) { static const uint8_t decodingarr64[128] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff, }; uint8_t index = (uint8_t)data; if ((index & 0x80) != 0) return false; if (decodingarr64[index] == 0xff) return false; *value = decodingarr64[index]; return true; } uint8_t *Base64ToBinary (const char *pData, uint32_t decodeSize, uint32_t *pDataSize) { uint8_t *ret; uint32_t size, ix, groups; if (pData == NULL || decodeSize == 0 || pDataSize == NULL) return NULL; if ((decodeSize % 4) != 0) { // must be multiples of 4 characters return NULL; } size = (decodeSize * 3) / 4; groups = decodeSize / 4; ret = (uint8_t *)MP4Calloc(size); if (ret == NULL) return NULL; for (ix = 0; ix < groups; ix++) { uint8_t value[4]; for (uint8_t jx = 0; jx < 4; jx++) { if (pData[jx] == '=') { if (ix != (groups - 1)) { free(ret); return NULL; } size--; value[jx] = 0; } else if (convertBase64(pData[jx], &value[jx]) == false) { free(ret); return NULL; } } ret[(ix * 3)] = value[0] << 2 | ((value[1] >> 4) & 0x3); ret[(ix * 3) + 1] = (value[1] << 4) | (value[2] >> 2 & 0xf); ret[(ix * 3) + 2] = ((value[2] & 0x3) << 6) | value[3]; pData += 4; } *pDataSize = size; return ret; } // log2 of value, rounded up static u_int8_t ilog2(u_int64_t value) { u_int64_t powerOf2 = 1; for (u_int8_t i = 0; i < 64; i++) { if (value <= powerOf2) { return i; } powerOf2 <<= 1; } return 64; } u_int64_t MP4ConvertTime(u_int64_t t, u_int32_t oldTimeScale, u_int32_t newTimeScale) { // avoid float point exception if (oldTimeScale == 0) { throw new MP4Error("division by zero", "MP4ConvertTime"); } if (oldTimeScale == newTimeScale) return t; // check if we can safely use integer operations if (ilog2(t) + ilog2(newTimeScale) <= 64) { return (t * newTimeScale) / oldTimeScale; } // final resort is to use floating point double d = (double)newTimeScale; d *= UINT64_TO_DOUBLE(t); d /= (double)oldTimeScale; d += 0.5; // round up. return (u_int64_t)d; } const char* MP4NormalizeTrackType (const char* type, uint32_t verbosity) { if (!strcasecmp(type, "vide") || !strcasecmp(type, "video") || !strcasecmp(type, "mp4v") || !strcasecmp(type, "avc1") || !strcasecmp(type, "s263") // 3GPP H.263 || !strcasecmp(type, "encv")) { return MP4_VIDEO_TRACK_TYPE; } if (!strcasecmp(type, "soun") || !strcasecmp(type, "sound") || !strcasecmp(type, "audio") || !strcasecmp(type, "enca") || !strcasecmp(type, "samr") // 3GPP AMR || !strcasecmp(type, "sawb") // 3GPP AMR/WB || !strcasecmp(type, "mp4a")) { return MP4_AUDIO_TRACK_TYPE; } if (!strcasecmp(type, "sdsm") || !strcasecmp(type, "scene") || !strcasecmp(type, "bifs")) { return MP4_SCENE_TRACK_TYPE; } if (!strcasecmp(type, "odsm") || !strcasecmp(type, "od")) { return MP4_OD_TRACK_TYPE; } if (strcasecmp(type, "cntl") == 0) { return MP4_CNTL_TRACK_TYPE; } VERBOSE_WARNING(verbosity, printf("Attempt to normalize %s did not match\n", type)); return type; } faac-1.28/common/mp4v2/mp4util.h0000644010307701030770000001354311136736372020072 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __MP4_UTIL_INCLUDED__ #define __MP4_UTIL_INCLUDED__ #include #ifndef ASSERT #define ASSERT(expr) \ if (!(expr)) { \ throw new MP4Error("assert failure", __STRING((expr))); \ } #endif #define WARNING(expr) \ if (expr) { \ fflush(stdout); \ fprintf(stderr, "Warning (%s) in %s at line %u\n", \ __STRING(expr), __FILE__, __LINE__); \ } #define VERBOSE(exprverbosity, verbosity, expr) \ if (((exprverbosity) & (verbosity)) == (exprverbosity)) { expr; } #define VERBOSE_ERROR(verbosity, expr) \ VERBOSE(MP4_DETAILS_ERROR, verbosity, expr) #define VERBOSE_WARNING(verbosity, expr) \ VERBOSE(MP4_DETAILS_WARNING, verbosity, expr) #define VERBOSE_READ(verbosity, expr) \ VERBOSE(MP4_DETAILS_READ, verbosity, expr) #define VERBOSE_READ_TABLE(verbosity, expr) \ VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_TABLE), verbosity, expr) #define VERBOSE_READ_SAMPLE(verbosity, expr) \ VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_SAMPLE), verbosity, expr) #define VERBOSE_READ_HINT(verbosity, expr) \ VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_HINT), verbosity, expr) #define VERBOSE_WRITE(verbosity, expr) \ VERBOSE(MP4_DETAILS_WRITE, verbosity, expr) #define VERBOSE_WRITE_TABLE(verbosity, expr) \ VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_TABLE), verbosity, expr) #define VERBOSE_WRITE_SAMPLE(verbosity, expr) \ VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_SAMPLE), verbosity, expr) #define VERBOSE_WRITE_HINT(verbosity, expr) \ VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_HINT), verbosity, expr) #define VERBOSE_FIND(verbosity, expr) \ VERBOSE(MP4_DETAILS_FIND, verbosity, expr) #define VERBOSE_ISMA(verbosity, expr) \ VERBOSE(MP4_DETAILS_ISMA, verbosity, expr) #define VERBOSE_EDIT(verbosity, expr) \ VERBOSE(MP4_DETAILS_EDIT, verbosity, expr) inline void Indent(FILE* pFile, u_int8_t depth) { fprintf(pFile, "%*c", depth, ' '); } static inline void MP4Printf(const char* fmt, ...) #ifndef _WIN32 __attribute__((format(__printf__, 1, 2))) #endif ; static inline void MP4Printf(const char* fmt, ...) { va_list ap; va_start(ap, fmt); // TBD API call to set error_msg_func instead of just printf vprintf(fmt, ap); va_end(ap); } class MP4Error { public: MP4Error() { m_errno = 0; m_errstring = NULL; m_where = NULL; m_free = 0; } ~MP4Error() { if (m_free != 0) { free((void *)m_errstring); } } MP4Error(int err, const char* where = NULL) { m_errno = err; m_errstring = NULL; m_where = where; m_free = 0; } MP4Error(const char *format, const char *where, ...) { char *string; m_errno = 0; string = (char *)malloc(512); m_where = where; if (string) { va_list ap; va_start(ap, where); vsnprintf(string, 512, format, ap); va_end(ap); m_errstring = string; m_free = 1; } else { m_errstring = format; m_free = 0; } } MP4Error(int err, const char* format, const char* where, ...) { char *string; m_errno = err; string = (char *)malloc(512); m_where = where; if (string) { va_list ap; va_start(ap, where); vsnprintf(string, 512, format, ap); va_end(ap); m_errstring = string; m_free = 1; } else { m_errstring = format; m_free = 0; } } void Print(FILE* pFile = stderr); int m_free; int m_errno; const char* m_errstring; const char* m_where; }; void MP4HexDump( u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = stdout, u_int8_t indent = 0); inline void* MP4Malloc(size_t size) { if (size == 0) return NULL; void* p = malloc(size); if (p == NULL && size > 0) { throw new MP4Error(errno); } return p; } inline void* MP4Calloc(size_t size) { if (size == 0) return NULL; return memset(MP4Malloc(size), 0, size); } inline char* MP4Stralloc(const char* s1) { char* s2 = (char*)MP4Malloc(strlen(s1) + 1); strcpy(s2, s1); return s2; } #ifdef _WIN32 inline wchar_t* MP4Stralloc(const wchar_t* s1) { wchar_t* s2 = (wchar_t*)MP4Malloc((wcslen(s1) + 1)*sizeof(wchar_t)); wcscpy(s2, s1); return s2; } #endif inline void* MP4Realloc(void* p, u_int32_t newSize) { // workaround library bug if (p == NULL && newSize == 0) { return NULL; } p = realloc(p, newSize); if (p == NULL && newSize > 0) { throw new MP4Error(errno); } return p; } inline u_int32_t STRTOINT32(const char* s) { return ntohl(*(uint32_t *)s); } inline void INT32TOSTR(u_int32_t i, char* s) { *(uint32_t *)s = htonl(i); s[4] = 0; } inline MP4Timestamp MP4GetAbsTimestamp() { struct timeval tv; gettimeofday(&tv, NULL); MP4Timestamp ret; ret = tv.tv_sec; ret += 2082844800; return ret; // MP4 start date is 1/1/1904 // 208284480 is (((1970 - 1904) * 365) + 17) * 24 * 60 * 60 } u_int64_t MP4ConvertTime(u_int64_t t, u_int32_t oldTimeScale, u_int32_t newTimeScale); bool MP4NameFirstMatches(const char* s1, const char* s2); bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex); char* MP4NameFirst(const char *s); const char* MP4NameAfterFirst(const char *s); char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize); char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize); const char* MP4NormalizeTrackType(const char* type, uint32_t verbosity); #endif /* __MP4_UTIL_INCLUDED__ */ faac-1.28/common/mp4v2/mpeg4ip.h0000644010307701030770000001570711137436133020036 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2000-2005. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com * Bill May wmay@cisco.com */ #ifndef __MPEG4IP_INCLUDED__ #define __MPEG4IP_INCLUDED__ /* project wide applicable stuff here */ #ifndef _WIN32 #ifdef PACKAGE_BUGREPORT #define TEMP_PACKAGE_BUGREPORT PACKAGE_BUGREPORT #define TEMP_PACKAGE_NAME PACKAGE_NAME #define TEMP_PACKAGE_STRING PACKAGE_STRING #define TEMP_PACKAGE_TARNAME PACKAGE_TARNAME #define TEMP_PACKAGE_VERSION PACKAGE_VERSION #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #include #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #define PACKAGE_BUGREPORT TEMP_PACKAGE_BUGREPORT #define PACKAGE_NAME TEMP_PACKAGE_NAME #define PACKAGE_STRING TEMP_PACKAGE_STRING #define PACKAGE_TARNAME TEMP_PACKAGE_TARNAME #define PACKAGE_VERSION TEMP_PACKAGE_VERSION #else #include #endif #endif // the mpeg4ip_package and mpeg4ip_version are always in this // file #include "mpeg4ip_version.h" #ifdef _WIN32 #include "mpeg4ip_win32.h" #include "mpeg4ip_version.h" #else /* UNIX */ /***************************************************************************** * UNIX LIKE DEFINES BELOW THIS POINT *****************************************************************************/ #ifdef sun #include #endif #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #else #ifndef sun #if _FILE_OFFSET_BITS < 64 #error File offset bits is already set to non-64 value #endif #endif #endif #ifndef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE #endif #include #include #include #ifdef HAVE_INTTYPES_H #include #endif #ifdef HAVE_STDINT_H #include #endif #if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H) #error "Don't have stdint.h or inttypes.h - no way to get uint8_t" #endif #include #include #include #include #include #include #include #include #include #include #include #include #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #include #ifdef __cplusplus extern "C" { #endif char *strcasestr(const char *haystack, const char *needle); #ifdef __cplusplus } #endif #define OPEN_RDWR O_RDWR #define OPEN_CREAT O_CREAT #define OPEN_RDONLY O_RDONLY #define closesocket close #define IOSBINARY ios::bin #if SIZEOF_LONG == 8 #define MAX_UINT64 -1LU #define D64F "ld" #define U64F "lu" #define X64F "lx" #define TO_D64(a) (a##L) #define TO_U64(a) (a##LU) #else #define MAX_UINT64 -1LLU #define D64F "lld" #define U64F "llu" #define X64F "llx" #define TO_D64(a) (a##LL) #define TO_U64(a) (a##LLU) #endif #ifdef HAVE_FPOS_T___POS #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos) #define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var) #else #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos) #define VAR_TO_FPOS(fpos, var) (fpos) = (var) #endif #define FOPEN_READ_BINARY "r" #define FOPEN_WRITE_BINARY "w" #define UINT64_TO_DOUBLE(a) ((double)(a)) #endif /* define unix */ /***************************************************************************** * Generic type includes used in the whole package * *****************************************************************************/ #define D64 "%"D64F #define U64 "%"U64F #define X64 "%"X64F #define M_LLU TO_U64(1000) #define M_64 TO_U64(1000) #define LLU U64 #include typedef void (*error_msg_func_t)(int loglevel, const char *lib, const char *fmt, va_list ap); typedef void (*lib_message_func_t)(int loglevel, const char *lib, const char *fmt, ...); #ifndef HAVE_IN_PORT_T typedef uint16_t in_port_t; #endif #ifndef HAVE_SOCKLEN_T typedef unsigned int socklen_t; #endif #ifdef sun #include #define u_int8_t uint8_t #define u_int16_t uint16_t #define u_int32_t uint32_t #define u_int64_t uint64_t #define __STRING(expr) #expr #endif #ifndef HAVE_STRSEP #ifdef __cplusplus extern "C" { #endif char *strsep(char **strp, const char *delim); #ifdef __cplusplus } #endif #endif #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef INADDR_NONE #define INADDR_NONE (-1) #endif #define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a))) #define CHECK_AND_FREE(a) if ((a) != NULL) { free((void *)(a)); (a) = NULL;} #define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name)))) #define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;} #ifndef HAVE_GTK typedef char gchar; typedef unsigned char guchar; typedef int gint; typedef unsigned int guint; typedef long glong; typedef unsigned long gulong; typedef double gdouble; typedef int gboolean; typedef int16_t gint16; typedef uint16_t guint16; typedef int32_t gint32; typedef uint32_t guint32; typedef int64_t gint64; typedef uint64_t guint64; typedef uint8_t guint8; typedef int8_t gint8; #endif #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #ifndef __cplusplus #ifndef bool #if SIZEOF_BOOL == 8 typedef uint64_t bool; #else #if SIZEOF_BOOL == 4 typedef uint32_t bool; #else #if SIZEOF_BOOL == 2 typedef uint16_t bool; #else typedef unsigned char bool; #endif #endif #endif #ifndef false #define false FALSE #endif #ifndef true #define true TRUE #endif #endif #endif #ifndef ROUND # ifdef HAVE_RINT # define ROUND(f) rint(f) # else # define ROUND(f) (int)(floor((f) + 0.5)) # endif #endif #ifndef INT16_MAX # define INT16_MAX (32767) #endif #ifndef INT16_MIN # define INT16_MIN (-32767-1) #endif #ifndef UINT32_MAX # define UINT32_MAX (4294967295U) #endif #ifndef UINT64_MAX # define UINT64_MAX TO_U64(0xffffffffffffffff) #endif typedef enum audio_format_t { AUDIO_FMT_U8 = 0, AUDIO_FMT_S8, AUDIO_FMT_U16LSB, AUDIO_FMT_S16LSB, AUDIO_FMT_U16MSB, AUDIO_FMT_S16MSB, AUDIO_FMT_U16, AUDIO_FMT_S16, AUDIO_FMT_FLOAT, AUDIO_FMT_HW_AC3, } audio_format_t; #endif /* __MPEG4IP_INCLUDED__ */ faac-1.28/common/mp4v2/mpeg4ip_version.h0000644010307701030770000000042711136736372021603 0ustar fabian-guestfabian-guest#define MPEG4IP_PACKAGE "mpeg4ip" #define MPEG4IP_VERSION "1.6.1" #define MPEG4IP_MAJOR_VERSION 0x1 #define MPEG4IP_MINOR_VERSION 0x6 #define MPEG4IP_CVS_VERSION 0x1 #define MPEG4IP_HEX_VERSION ((MPEG4IP_MAJOR_VERSION << 16) | (MPEG4IP_MINOR_VERSION << 8) | MPEG4IP_CVS_VERSION) faac-1.28/common/mp4v2/mpeg4ip_win32.h0000644010307701030770000001036011136736372021055 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2005. All Rights Reserved. * * Contributor(s): * Bill May wmay@cisco.com */ /* windows defines */ #ifndef __MPEG4IP_WIN32_H__ #define __MPEG4IP_WIN32_H__ #define HAVE_IN_PORT_T #define HAVE_SOCKLEN_T #define NEED_SDL_VIDEO_IN_MAIN_THREAD #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif #define _WINSOCKAPI_ #define _INTEGRAL_MAX_BITS 64 #ifndef __GNUC__ #define _CRT_SECURE_NO_DEPRECATE 1 #ifndef _WIN32 #define _WIN32 #endif #endif #include #include #include #include #include #include #include #ifndef inline #define inline __inline #endif typedef unsigned __int64 uint64_t; typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; typedef unsigned __int8 uint8_t; typedef unsigned __int64 u_int64_t; typedef unsigned __int32 u_int32_t; typedef unsigned __int16 u_int16_t; typedef unsigned __int8 u_int8_t; typedef signed __int64 int64_t; typedef signed __int32 int32_t; typedef signed __int16 int16_t; typedef signed __int8 int8_t; typedef unsigned short in_port_t; typedef int socklen_t; typedef int ssize_t; typedef unsigned int uint; static inline int snprintf(char *buffer, size_t count, const char *format, ...) { va_list ap; int ret; va_start(ap, format); ret = vsnprintf_s(buffer, count, _TRUNCATE, format, ap); va_end(ap); if (ret == -1) { if (errno == EINVAL) return -1; return (int)count; } return ret; } #define strncasecmp _strnicmp #define strcasecmp _stricmp #define localtime_r(a,b) localtime_s(b,a) #define printf printf_s #define fprintf fprintf_s #include #include #include #include #ifndef __GNUC__ #define read _read #define write _write #define lseek _lseek #define close _close #define open _open #define access _access #define vsnprintf _vsnprintf #define stat _stati64 #define fstat _fstati64 #define fileno _fileno #define strdup _strdup #endif #define F_OK 0 #define OPEN_RDWR (_O_RDWR | _O_BINARY) #define OPEN_CREAT (_O_CREAT | _O_BINARY) #define OPEN_RDONLY (_O_RDONLY | _O_BINARY) #define srandom srand #define random rand #define IOSBINARY ios::binary #ifdef __cplusplus extern "C" { #endif int gettimeofday(struct timeval *t, void *); #ifdef __cplusplus } #endif #ifndef PATH_MAX #define PATH_MAX MAX_PATH #endif #define MAX_UINT64 -1 #define D64F "I64d" #define U64F "I64u" #define X64F "I64x" #define TO_D64(a) (a##I64) #define TO_U64(a) (a##UI64) #define LOG_EMERG 0 #define LOG_ALERT 1 #define LOG_CRIT 2 #define LOG_ERR 3 #define LOG_WARNING 4 #define LOG_NOTICE 5 #define LOG_INFO 6 #define LOG_DEBUG 7 #if defined (__GNUC__) || (!__STDC__ && _INTEGRAL_MAX_BITS >= 64) #define VAR_TO_FPOS(fpos, var) (fpos) = (var) #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos) #else #define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32) #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart) #endif #define __STRING(expr) #expr #define FOPEN_READ_BINARY "rb" #define FOPEN_WRITE_BINARY "wb" #define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a))) #ifdef __cplusplus extern "C" { #endif char *strcasestr(const char *haystack, const char *needle); #ifdef __cplusplus } #endif #define SIZEOF_BOOL 1 #ifndef __GNUC__ #ifndef _SS_PAD1SIZE struct sockaddr_storage { unsigned short ss_family; uint32_t ss_align; char __ss_padding[128 - 2 * sizeof(uint32_t)]; }; #endif #pragma warning(disable : 4244) #pragma warning(disable: 4996) #define HAVE_STRUCT_SOCKADDR_STORAGE 1 #define HAVE_INET_PTON 1 #define HAVE_INET_NTOP 1 #endif #endif faac-1.28/common/mp4v2/need_for_win32.c0000644010307701030770000000031710101411050021233 0ustar fabian-guestfabian-guest#include "mpeg4ip.h" #include int gettimeofday (struct timeval *t, void *foo) { struct _timeb temp; _ftime(&temp); t->tv_sec = temp.time; t->tv_usec = temp.millitm * 1000; return (0); } faac-1.28/common/mp4v2/ocidescriptors.cpp0000644010307701030770000002033210101411050022023 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4ContentClassDescriptor::MP4ContentClassDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4Integer32Property("classificationEntity")); AddProperty( /* 1 */ new MP4Integer16Property("classificationTable")); AddProperty( /* 2 */ new MP4BytesProperty("contentClassificationData")); } void MP4ContentClassDescriptor::Read(MP4File* pFile) { ReadHeader(pFile); /* byte properties need to know how long they are before reading */ ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6); ReadProperties(pFile); } MP4KeywordDescriptor::MP4KeywordDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("languageCode", 3)); AddProperty( /* 1 */ new MP4BitfieldProperty("isUTF8String", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("reserved", 7)); MP4Integer8Property* pCount = new MP4Integer8Property("keywordCount"); AddProperty(pCount); /* 3 */ MP4TableProperty* pTable = new MP4TableProperty("keywords", pCount); AddProperty(pTable); /* 4 */ pTable->AddProperty( /* 4, 0 */ new MP4StringProperty("string", Counted)); SetReadMutate(2); } void MP4KeywordDescriptor::Mutate() { bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); MP4Property* pProperty = ((MP4TableProperty*)m_pProperties[4])->GetProperty(0); ASSERT(pProperty); ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); } MP4RatingDescriptor::MP4RatingDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4Integer32Property("ratingEntity")); AddProperty( /* 1 */ new MP4Integer16Property("ratingCriteria")); AddProperty( /* 2 */ new MP4BytesProperty("ratingInfo")); } void MP4RatingDescriptor::Read(MP4File* pFile) { ReadHeader(pFile); /* byte properties need to know how long they are before reading */ ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6); ReadProperties(pFile); } MP4LanguageDescriptor::MP4LanguageDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("languageCode", 3)); } MP4ShortTextDescriptor::MP4ShortTextDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("languageCode", 3)); AddProperty( /* 1 */ new MP4BitfieldProperty("isUTF8String", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("reserved", 7)); AddProperty( /* 3 */ new MP4StringProperty("eventName", Counted)); AddProperty( /* 4 */ new MP4StringProperty("eventText", Counted)); SetReadMutate(2); } void MP4ShortTextDescriptor::Mutate() { bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); ((MP4StringProperty*)m_pProperties[4])->SetUnicode(!utf8Flag); } MP4ExpandedTextDescriptor::MP4ExpandedTextDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("languageCode", 3)); AddProperty( /* 1 */ new MP4BitfieldProperty("isUTF8String", 1)); AddProperty( /* 2 */ new MP4BitfieldProperty("reserved", 7)); MP4Integer8Property* pCount = new MP4Integer8Property("itemCount"); AddProperty(pCount); /* 3 */ MP4TableProperty* pTable = new MP4TableProperty("items", pCount); AddProperty(pTable); /* 4 */ pTable->AddProperty( /* Table 0 */ new MP4StringProperty("itemDescription", Counted)); pTable->AddProperty( /* Table 1 */ new MP4StringProperty("itemText", Counted)); AddProperty( /* 5 */ new MP4StringProperty("nonItemText")); ((MP4StringProperty*)m_pProperties[5])->SetExpandedCountedFormat(true); SetReadMutate(2); } void MP4ExpandedTextDescriptor::Mutate() { bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); MP4Property* pProperty = ((MP4TableProperty*)m_pProperties[4])->GetProperty(0); ASSERT(pProperty); ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); pProperty = ((MP4TableProperty*)m_pProperties[4])->GetProperty(1); ASSERT(pProperty); ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); ((MP4StringProperty*)m_pProperties[5])->SetUnicode(!utf8Flag); } class MP4CreatorTableProperty : public MP4TableProperty { public: MP4CreatorTableProperty(char* name, MP4Integer8Property* pCountProperty) : MP4TableProperty(name, pCountProperty) { }; protected: void ReadEntry(MP4File* pFile, u_int32_t index); void WriteEntry(MP4File* pFile, u_int32_t index); }; MP4CreatorDescriptor::MP4CreatorDescriptor(u_int8_t tag) : MP4Descriptor(tag) { MP4Integer8Property* pCount = new MP4Integer8Property("creatorCount"); AddProperty(pCount); /* 0 */ MP4TableProperty* pTable = new MP4CreatorTableProperty("creators", pCount); AddProperty(pTable); /* 1 */ pTable->AddProperty( /* Table 0 */ new MP4BytesProperty("languageCode", 3, 3)); pTable->AddProperty( /* Table 1 */ new MP4BitfieldProperty("isUTF8String", 1)); pTable->AddProperty( /* Table 2 */ new MP4BitfieldProperty("reserved", 7)); pTable->AddProperty( /* Table 3 */ new MP4StringProperty("name", Counted)); } void MP4CreatorTableProperty::ReadEntry(MP4File* pFile, u_int32_t index) { m_pProperties[0]->Read(pFile, index); m_pProperties[1]->Read(pFile, index); bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index); ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); m_pProperties[2]->Read(pFile, index); m_pProperties[3]->Read(pFile, index); } void MP4CreatorTableProperty::WriteEntry(MP4File* pFile, u_int32_t index) { bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index); ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); MP4TableProperty::WriteEntry(pFile, index); } MP4CreationDescriptor::MP4CreationDescriptor(u_int8_t tag) : MP4Descriptor(tag) { AddProperty( /* 0 */ new MP4BitfieldProperty("contentCreationDate", 40)); } MP4SmpteCameraDescriptor::MP4SmpteCameraDescriptor() : MP4Descriptor() { MP4Integer8Property* pCount = new MP4Integer8Property("parameterCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("parameters", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer8Property("id")); pTable->AddProperty( new MP4Integer32Property("value")); } MP4UnknownOCIDescriptor::MP4UnknownOCIDescriptor() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("data")); } void MP4UnknownOCIDescriptor::Read(MP4File* pFile) { ReadHeader(pFile); /* byte properties need to know how long they are before reading */ ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); ReadProperties(pFile); } MP4Descriptor* CreateOCIDescriptor(u_int8_t tag) { MP4Descriptor* pDescriptor = NULL; switch (tag) { case MP4ContentClassDescrTag: pDescriptor = new MP4ContentClassDescriptor(); break; case MP4KeywordDescrTag: pDescriptor = new MP4KeywordDescriptor(); break; case MP4RatingDescrTag: pDescriptor = new MP4RatingDescriptor(); break; case MP4LanguageDescrTag: pDescriptor = new MP4LanguageDescriptor(); break; case MP4ShortTextDescrTag: pDescriptor = new MP4ShortTextDescriptor(); break; case MP4ExpandedTextDescrTag: pDescriptor = new MP4ExpandedTextDescriptor(); break; case MP4ContentCreatorDescrTag: case MP4OCICreatorDescrTag: pDescriptor = new MP4CreatorDescriptor(tag); break; case MP4ContentCreationDescrTag: case MP4OCICreationDescrTag: pDescriptor = new MP4CreationDescriptor(tag); break; case MP4SmpteCameraDescrTag: pDescriptor = new MP4SmpteCameraDescriptor(); break; } if (pDescriptor == NULL) { if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) { pDescriptor = new MP4UnknownOCIDescriptor(); pDescriptor->SetTag(tag); } } return pDescriptor; } faac-1.28/common/mp4v2/ocidescriptors.h0000644010307701030770000000516610101411050021500 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __OCIDESCRIPTORS_INCLUDED__ #define __OCIDESCRIPTORS_INCLUDED__ const u_int8_t MP4OCIDescrTagsStart = 0x40; const u_int8_t MP4ContentClassDescrTag = 0x40; const u_int8_t MP4KeywordDescrTag = 0x41; const u_int8_t MP4RatingDescrTag = 0x42; const u_int8_t MP4LanguageDescrTag = 0x43; const u_int8_t MP4ShortTextDescrTag = 0x44; const u_int8_t MP4ExpandedTextDescrTag = 0x45; const u_int8_t MP4ContentCreatorDescrTag = 0x46; const u_int8_t MP4ContentCreationDescrTag = 0x47; const u_int8_t MP4OCICreatorDescrTag = 0x48; const u_int8_t MP4OCICreationDescrTag = 0x49; const u_int8_t MP4SmpteCameraDescrTag = 0x4A; const u_int8_t MP4OCIDescrTagsEnd = 0x5F; class MP4ContentClassDescriptor : public MP4Descriptor { public: MP4ContentClassDescriptor(); void Read(MP4File* pFile); }; class MP4KeywordDescriptor : public MP4Descriptor { public: MP4KeywordDescriptor(); protected: void Mutate(); }; class MP4RatingDescriptor : public MP4Descriptor { public: MP4RatingDescriptor(); void Read(MP4File* pFile); }; class MP4LanguageDescriptor : public MP4Descriptor { public: MP4LanguageDescriptor(); }; class MP4ShortTextDescriptor : public MP4Descriptor { public: MP4ShortTextDescriptor(); protected: void Mutate(); }; class MP4ExpandedTextDescriptor : public MP4Descriptor { public: MP4ExpandedTextDescriptor(); protected: void Mutate(); }; class MP4CreatorDescriptor : public MP4Descriptor { public: MP4CreatorDescriptor(u_int8_t tag); }; class MP4CreationDescriptor : public MP4Descriptor { public: MP4CreationDescriptor(u_int8_t tag); }; class MP4SmpteCameraDescriptor : public MP4Descriptor { public: MP4SmpteCameraDescriptor(); }; class MP4UnknownOCIDescriptor : public MP4Descriptor { public: MP4UnknownOCIDescriptor(); void Read(MP4File* pFile); }; extern MP4Descriptor *CreateOCIDescriptor(u_int8_t tag); #endif /* __OCIDESCRIPTORS_INCLUDED__ */ faac-1.28/common/mp4v2/odcommands.cpp0000644010307701030770000000564210101411050021122 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" MP4ODUpdateDescriptor::MP4ODUpdateDescriptor() : MP4Descriptor(MP4ODUpdateODCommandTag) { // just a container for ObjectDescriptors AddProperty( /* 0 */ new MP4DescriptorProperty(NULL, MP4FileODescrTag, 0, Required, Many)); } MP4ODRemoveDescriptor::MP4ODRemoveDescriptor() : MP4Descriptor(MP4ODRemoveODCommandTag) { MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetImplicit(); AddProperty(pCount); /* 0 */ MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); /* 1 */ pTable->AddProperty( /* 1, 0 */ new MP4BitfieldProperty("objectDescriptorId", 10)); } void MP4ODRemoveDescriptor::Read(MP4File* pFile) { // table entry count computed from descriptor size ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false); ((MP4Integer32Property*)m_pProperties[0])->SetValue((m_size * 8) / 10); ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true); MP4Descriptor::Read(pFile); } MP4ESUpdateDescriptor::MP4ESUpdateDescriptor() : MP4Descriptor(MP4ESUpdateODCommandTag) { AddProperty( /* 0 */ new MP4BitfieldProperty("objectDescriptorId", 10)); AddProperty( /* 1 */ new MP4BitfieldProperty("pad", 6)); AddProperty( /* 2 */ new MP4DescriptorProperty("esIdRefs", MP4ESIDRefDescrTag, 0, Required, Many)); } // LATER might be able to combine with ESUpdateDescriptor MP4ESRemoveDescriptor::MP4ESRemoveDescriptor() : MP4Descriptor(MP4ESRemoveODCommandTag) { AddProperty( /* 0 */ new MP4BitfieldProperty("objectDescriptorId", 10)); AddProperty( /* 1 */ new MP4BitfieldProperty("pad", 6)); AddProperty( /* 2 */ new MP4DescriptorProperty("esIdRefs", MP4ESIDRefDescrTag, 0, Required, Many)); } MP4Descriptor* CreateODCommand(u_int8_t tag) { MP4Descriptor* pDescriptor = NULL; switch (tag) { case MP4ODUpdateODCommandTag: pDescriptor = new MP4ODUpdateDescriptor(); break; case MP4ODRemoveODCommandTag: pDescriptor = new MP4ODRemoveDescriptor(); break; case MP4ESUpdateODCommandTag: pDescriptor = new MP4ESUpdateDescriptor(); break; case MP4ESRemoveODCommandTag: pDescriptor = new MP4ESRemoveDescriptor(); break; } return pDescriptor; } faac-1.28/common/mp4v2/odcommands.h0000644010307701030770000000324410101411050020563 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __ODCOMMANDS_INCLUDED__ #define __ODCOMMANDS_INCLUDED__ // OD stream command descriptors const u_int8_t MP4ODUpdateODCommandTag = 0x01; const u_int8_t MP4ODRemoveODCommandTag = 0x02; const u_int8_t MP4ESUpdateODCommandTag = 0x03; const u_int8_t MP4ESRemoveODCommandTag = 0x04; const u_int8_t MP4IPMPUpdateODCommandTag = 0x05; const u_int8_t MP4IPMPRemoveODCommandTag = 0x06; const u_int8_t MP4ESRemoveRefODCommandTag = 0x07; class MP4ODUpdateDescriptor : public MP4Descriptor { public: MP4ODUpdateDescriptor(); }; class MP4ODRemoveDescriptor : public MP4Descriptor { public: MP4ODRemoveDescriptor(); void Read(MP4File* pFile); }; class MP4ESUpdateDescriptor : public MP4Descriptor { public: MP4ESUpdateDescriptor(); }; class MP4ESRemoveDescriptor : public MP4Descriptor { public: MP4ESRemoveDescriptor(); }; MP4Descriptor* CreateODCommand(u_int8_t tag); #endif /* __ODCOMMANDS_INCLUDED__ */ faac-1.28/common/mp4v2/qosqualifiers.cpp0000644010307701030770000001111311136736372021705 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" #if 1 MP4QosDescriptorBase::MP4QosDescriptorBase (u_int8_t tag) : MP4Descriptor(tag) { switch (tag) { case MP4QosDescrTag: AddProperty( /* 0 */ new MP4Integer8Property("predefined")); AddProperty( /* 1 */ new MP4QosQualifierProperty("qualifiers", MP4QosTagsStart, MP4QosTagsEnd, Optional, Many)); break; case MP4MaxDelayQosTag: AddProperty( /* 0 */ new MP4Integer32Property("maxDelay")); break; case MP4PrefMaxDelayQosTag: AddProperty( /* 0 */ new MP4Integer32Property("prefMaxDelay")); break; case MP4LossProbQosTag: AddProperty( /* 0 */ new MP4Float32Property("lossProb")); break; case MP4MaxGapLossQosTag: AddProperty( /* 0 */ new MP4Integer32Property("maxGapLoss")); break; case MP4MaxAUSizeQosTag: AddProperty( /* 0 */ new MP4Integer32Property("maxAUSize")); break; case MP4AvgAUSizeQosTag: AddProperty( /* 0 */ new MP4Integer32Property("avgAUSize")); break; case MP4MaxAURateQosTag: AddProperty( /* 0 */ new MP4Integer32Property("maxAURate")); break; } } #else MP4QosDescriptor::MP4QosDescriptor() : MP4Descriptor(MP4QosDescrTag) { AddProperty( /* 0 */ new MP4Integer8Property("predefined")); AddProperty( /* 1 */ new MP4QosQualifierProperty("qualifiers", MP4QosTagsStart, MP4QosTagsEnd, Optional, Many)); } MP4MaxDelayQosQualifier::MP4MaxDelayQosQualifier() : MP4QosQualifier(MP4MaxDelayQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("maxDelay")); } MP4PrefMaxDelayQosQualifier::MP4PrefMaxDelayQosQualifier() : MP4QosQualifier(MP4PrefMaxDelayQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("prefMaxDelay")); } MP4LossProbQosQualifier::MP4LossProbQosQualifier() : MP4QosQualifier(MP4LossProbQosTag) { AddProperty( /* 0 */ new MP4Float32Property("lossProb")); } MP4MaxGapLossQosQualifier::MP4MaxGapLossQosQualifier() : MP4QosQualifier(MP4MaxGapLossQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("maxGapLoss")); } MP4MaxAUSizeQosQualifier::MP4MaxAUSizeQosQualifier() : MP4QosQualifier(MP4MaxAUSizeQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("maxAUSize")); } MP4AvgAUSizeQosQualifier::MP4AvgAUSizeQosQualifier() : MP4QosQualifier(MP4AvgAUSizeQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("avgAUSize")); } MP4MaxAURateQosQualifier::MP4MaxAURateQosQualifier() : MP4QosQualifier(MP4MaxAURateQosTag) { AddProperty( /* 0 */ new MP4Integer32Property("maxAURate")); } #endif MP4UnknownQosQualifier::MP4UnknownQosQualifier() : MP4Descriptor() { AddProperty( /* 0 */ new MP4BytesProperty("data")); } void MP4UnknownQosQualifier::Read(MP4File* pFile) { ReadHeader(pFile); /* byte properties need to know how long they are before reading */ ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); ReadProperties(pFile); } MP4Descriptor* MP4QosQualifierProperty::CreateDescriptor(u_int8_t tag) { MP4Descriptor* pDescriptor = NULL; switch (tag) { #if 0 case MP4MaxDelayQosTag: pDescriptor = new MP4MaxDelayQosQualifier(); break; case MP4PrefMaxDelayQosTag: pDescriptor = new MP4PrefMaxDelayQosQualifier(); break; case MP4LossProbQosTag: pDescriptor = new MP4LossProbQosQualifier(); break; case MP4MaxGapLossQosTag: pDescriptor = new MP4MaxGapLossQosQualifier(); break; case MP4MaxAUSizeQosTag: pDescriptor = new MP4MaxAUSizeQosQualifier(); break; case MP4AvgAUSizeQosTag: pDescriptor = new MP4AvgAUSizeQosQualifier(); break; case MP4MaxAURateQosTag: pDescriptor = new MP4MaxAURateQosQualifier(); break; #else case MP4MaxDelayQosTag: case MP4PrefMaxDelayQosTag: case MP4LossProbQosTag: case MP4MaxGapLossQosTag: case MP4MaxAUSizeQosTag: case MP4AvgAUSizeQosTag: case MP4MaxAURateQosTag: pDescriptor = new MP4QosDescriptorBase(tag); break; #endif default: pDescriptor = new MP4UnknownQosQualifier(); pDescriptor->SetTag(tag); } return pDescriptor; } faac-1.28/common/mp4v2/qosqualifiers.h0000644010307701030770000000453611136736372021365 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __QOSQUALIFIERS_INCLUDED__ #define __QOSQUALIFIERS_INCLUDED__ const u_int8_t MP4QosDescrTag = 0x0C; #if 0 class MP4QosDescriptor : public MP4Descriptor { public: MP4QosDescriptor(); }; typedef MP4Descriptor MP4QosQualifier; #endif const u_int8_t MP4QosTagsStart = 0x01; const u_int8_t MP4MaxDelayQosTag = 0x01; const u_int8_t MP4PrefMaxDelayQosTag = 0x02; const u_int8_t MP4LossProbQosTag = 0x03; const u_int8_t MP4MaxGapLossQosTag = 0x04; const u_int8_t MP4MaxAUSizeQosTag = 0x41; const u_int8_t MP4AvgAUSizeQosTag = 0x42; const u_int8_t MP4MaxAURateQosTag = 0x43; const u_int8_t MP4QosTagsEnd = 0xFF; #if 0 class MP4MaxDelayQosQualifier : public MP4QosQualifier { public: MP4MaxDelayQosQualifier(); }; class MP4PrefMaxDelayQosQualifier : public MP4QosQualifier { public: MP4PrefMaxDelayQosQualifier(); }; class MP4LossProbQosQualifier : public MP4QosQualifier { public: MP4LossProbQosQualifier(); }; class MP4MaxGapLossQosQualifier : public MP4QosQualifier { public: MP4MaxGapLossQosQualifier(); }; class MP4MaxAUSizeQosQualifier : public MP4QosQualifier { public: MP4MaxAUSizeQosQualifier(); }; class MP4AvgAUSizeQosQualifier : public MP4QosQualifier { public: MP4AvgAUSizeQosQualifier(); }; class MP4MaxAURateQosQualifier : public MP4QosQualifier { public: MP4MaxAURateQosQualifier(); }; #else class MP4QosDescriptorBase : public MP4Descriptor { public: MP4QosDescriptorBase(uint8_t tag); }; #endif class MP4UnknownQosQualifier : public MP4Descriptor { public: MP4UnknownQosQualifier(); void Read(MP4File* pFile); }; #endif /* __QOSQUALIFIERS_INCLUDED__ */ faac-1.28/common/mp4v2/rtphint.cpp0000644010307701030770000010242211136736372020512 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #include "mp4common.h" /* rtp hint track operations */ MP4RtpHintTrack::MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom) : MP4Track(pFile, pTrakAtom) { m_pRefTrack = NULL; m_pRtpMapProperty = NULL; m_pPayloadNumberProperty = NULL; m_pMaxPacketSizeProperty = NULL; m_pSnroProperty = NULL; m_pTsroProperty = NULL; m_pReadHint = NULL; m_pReadHintSample = NULL; m_readHintSampleSize = 0; m_pWriteHint = NULL; m_writeHintId = MP4_INVALID_SAMPLE_ID; m_writePacketId = 0; m_pTrpy = NULL; m_pNump = NULL; m_pTpyl = NULL; m_pMaxr = NULL; m_pDmed = NULL; m_pDimm = NULL; m_pPmax = NULL; m_pDmax = NULL; m_pMaxPdu = NULL; m_pAvgPdu = NULL; m_pMaxBitRate = NULL; m_pAvgBitRate = NULL; m_thisSec = 0; m_bytesThisSec = 0; m_bytesThisHint = 0; m_bytesThisPacket = 0; } MP4RtpHintTrack::~MP4RtpHintTrack() { delete m_pReadHint; delete m_pReadHintSample; delete m_pWriteHint; } void MP4RtpHintTrack::InitRefTrack() { if (m_pRefTrack == NULL) { MP4Integer32Property* pRefTrackIdProperty = NULL; (void)m_pTrakAtom->FindProperty( "trak.tref.hint.entries[0].trackId", (MP4Property**)&pRefTrackIdProperty); ASSERT(pRefTrackIdProperty); m_pRefTrack = m_pFile->GetTrack(pRefTrackIdProperty->GetValue()); } } void MP4RtpHintTrack::InitRtpStart() { struct timeval tv; (void)gettimeofday(&tv, NULL); srandom((tv.tv_usec << 12) | (tv.tv_sec & 0xFFF)); ASSERT(m_pTrakAtom); (void)m_pTrakAtom->FindProperty( "trak.udta.hnti.rtp .snro.offset", (MP4Property**)&m_pSnroProperty); if (m_pSnroProperty) { m_rtpSequenceStart = m_pSnroProperty->GetValue(); } else { m_rtpSequenceStart = random(); } (void)m_pTrakAtom->FindProperty( "trak.udta.hnti.rtp .tsro.offset", (MP4Property**)&m_pTsroProperty); if (m_pTsroProperty) { m_rtpTimestampStart = m_pTsroProperty->GetValue(); } else { m_rtpTimestampStart = random(); } } void MP4RtpHintTrack::ReadHint( MP4SampleId hintSampleId, u_int16_t* pNumPackets) { if (m_pRefTrack == NULL) { InitRefTrack(); InitRtpStart(); } // dispose of any old hint delete m_pReadHint; m_pReadHint = NULL; delete m_pReadHintSample; m_pReadHintSample = NULL; m_readHintSampleSize = 0; // read the desired hint sample into memory ReadSample( hintSampleId, &m_pReadHintSample, &m_readHintSampleSize, &m_readHintTimestamp); m_pFile->EnableMemoryBuffer(m_pReadHintSample, m_readHintSampleSize); m_pReadHint = new MP4RtpHint(this); m_pReadHint->Read(m_pFile); m_pFile->DisableMemoryBuffer(); if (pNumPackets) { *pNumPackets = GetHintNumberOfPackets(); } } u_int16_t MP4RtpHintTrack::GetHintNumberOfPackets() { if (m_pReadHint == NULL) { throw new MP4Error("no hint has been read", "MP4GetRtpHintNumberOfPackets"); } return m_pReadHint->GetNumberOfPackets(); } bool MP4RtpHintTrack::GetPacketBFrame(u_int16_t packetIndex) { if (m_pReadHint == NULL) { throw new MP4Error("no hint has been read", "MP4GetRtpPacketBFrame"); } MP4RtpPacket* pPacket = m_pReadHint->GetPacket(packetIndex); return pPacket->IsBFrame(); } u_int16_t MP4RtpHintTrack::GetPacketTransmitOffset(u_int16_t packetIndex) { if (m_pReadHint == NULL) { throw new MP4Error("no hint has been read", "MP4GetRtpPacketTransmitOffset"); } MP4RtpPacket* pPacket = m_pReadHint->GetPacket(packetIndex); return pPacket->GetTransmitOffset(); } void MP4RtpHintTrack::ReadPacket( u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc, bool addHeader, bool addPayload) { if (m_pReadHint == NULL) { throw new MP4Error("no hint has been read", "MP4ReadRtpPacket"); } if (!addHeader && !addPayload) { throw new MP4Error("no data requested", "MP4ReadRtpPacket"); } MP4RtpPacket* pPacket = m_pReadHint->GetPacket(packetIndex); *pNumBytes = 0; if (addHeader) { *pNumBytes += 12; } if (addPayload) { *pNumBytes += pPacket->GetDataSize(); } // if needed, allocate the packet memory bool buffer_malloc = false; if (*ppBytes == NULL) { *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); buffer_malloc = true; } try { u_int8_t* pDest = *ppBytes; if (addHeader) { *pDest++ = 0x80 | (pPacket->GetPBit() << 5) | (pPacket->GetXBit() << 4); *pDest++ = (pPacket->GetMBit() << 7) | pPacket->GetPayload(); *((u_int16_t*)pDest) = htons(m_rtpSequenceStart + pPacket->GetSequenceNumber()); pDest += 2; *((u_int32_t*)pDest) = htonl(m_rtpTimestampStart + (u_int32_t)m_readHintTimestamp); pDest += 4; *((u_int32_t*)pDest) = htonl(ssrc); pDest += 4; } if (addPayload) { pPacket->GetData(pDest); } } catch (MP4Error* e) { if (buffer_malloc) { MP4Free(*ppBytes); *ppBytes = NULL; } throw e; } VERBOSE_READ_HINT(m_pFile->GetVerbosity(), printf("ReadPacket: %u ", packetIndex); MP4HexDump(*ppBytes, *pNumBytes);); } MP4Timestamp MP4RtpHintTrack::GetRtpTimestampStart() { if (m_pRefTrack == NULL) { InitRefTrack(); InitRtpStart(); } return m_rtpTimestampStart; } void MP4RtpHintTrack::SetRtpTimestampStart(MP4Timestamp start) { if (!m_pTsroProperty) { MP4Atom* pTsroAtom = m_pFile->AddDescendantAtoms(m_pTrakAtom, "udta.hnti.rtp .tsro"); ASSERT(pTsroAtom); (void)pTsroAtom->FindProperty("offset", (MP4Property**)&m_pTsroProperty); ASSERT(m_pTsroProperty); } m_pTsroProperty->SetValue(start); m_rtpTimestampStart = start; } void MP4RtpHintTrack::InitPayload() { ASSERT(m_pTrakAtom); if (m_pRtpMapProperty == NULL) { (void)m_pTrakAtom->FindProperty( "trak.udta.hinf.payt.rtpMap", (MP4Property**)&m_pRtpMapProperty); } if (m_pPayloadNumberProperty == NULL) { (void)m_pTrakAtom->FindProperty( "trak.udta.hinf.payt.payloadNumber", (MP4Property**)&m_pPayloadNumberProperty); } if (m_pMaxPacketSizeProperty == NULL) { (void)m_pTrakAtom->FindProperty( "trak.mdia.minf.stbl.stsd.rtp .maxPacketSize", (MP4Property**)&m_pMaxPacketSizeProperty); } } void MP4RtpHintTrack::GetPayload( char** ppPayloadName, u_int8_t* pPayloadNumber, u_int16_t* pMaxPayloadSize, char **ppEncodingParams) { const char* pRtpMap; const char* pSlash; u_int32_t length; InitPayload(); if (ppPayloadName || ppEncodingParams) { if (ppPayloadName) *ppPayloadName = NULL; if (ppEncodingParams) *ppEncodingParams = NULL; if (m_pRtpMapProperty) { pRtpMap = m_pRtpMapProperty->GetValue(); pSlash = strchr(pRtpMap, '/'); if (pSlash) { length = pSlash - pRtpMap; } else { length = strlen(pRtpMap); } if (ppPayloadName) { *ppPayloadName = (char*)MP4Calloc(length + 1); strncpy(*ppPayloadName, pRtpMap, length); } if (pSlash && ppEncodingParams) { pSlash++; pSlash = strchr(pSlash, '/'); if (pSlash != NULL) { pSlash++; if (pSlash != '\0') { length = strlen(pRtpMap) - (pSlash - pRtpMap); *ppEncodingParams = (char *)MP4Calloc(length + 1); strncpy(*ppEncodingParams, pSlash, length); } } } } } if (pPayloadNumber) { if (m_pPayloadNumberProperty) { *pPayloadNumber = m_pPayloadNumberProperty->GetValue(); } else { *pPayloadNumber = 0; } } if (pMaxPayloadSize) { if (m_pMaxPacketSizeProperty) { *pMaxPayloadSize = m_pMaxPacketSizeProperty->GetValue(); } else { *pMaxPayloadSize = 0; } } } void MP4RtpHintTrack::SetPayload( const char* payloadName, u_int8_t payloadNumber, u_int16_t maxPayloadSize, const char *encoding_parms, bool include_rtp_map, bool include_mpeg4_esid) { InitRefTrack(); InitPayload(); ASSERT(m_pRtpMapProperty); ASSERT(m_pPayloadNumberProperty); ASSERT(m_pMaxPacketSizeProperty); size_t len = strlen(payloadName) + 16; if (encoding_parms != NULL) { size_t temp = strlen(encoding_parms); if (temp == 0) { encoding_parms = NULL; } else { len += temp; } } char* rtpMapBuf = (char*)MP4Malloc(len); snprintf(rtpMapBuf, len, "%s/%u%c%s", payloadName, GetTimeScale(), encoding_parms != NULL ? '/' : '\0', encoding_parms == NULL ? "" : encoding_parms); m_pRtpMapProperty->SetValue(rtpMapBuf); m_pPayloadNumberProperty->SetValue(payloadNumber); if (maxPayloadSize == 0) { maxPayloadSize = 1460; } m_pMaxPacketSizeProperty->SetValue(maxPayloadSize); // set sdp media type const char* sdpMediaType; if (!strcmp(m_pRefTrack->GetType(), MP4_AUDIO_TRACK_TYPE)) { sdpMediaType = "audio"; } else if (!strcmp(m_pRefTrack->GetType(), MP4_VIDEO_TRACK_TYPE)) { sdpMediaType = "video"; } else if (!strcmp(m_pRefTrack->GetType(), MP4_CNTL_TRACK_TYPE)) { sdpMediaType = "control"; } else { sdpMediaType = "application"; } uint32_t maxlen = strlen(sdpMediaType) + strlen(rtpMapBuf) + 256; char* sdpBuf = (char*)MP4Malloc(maxlen); uint32_t buflen; buflen = snprintf(sdpBuf, maxlen, "m=%s 0 RTP/AVP %u\015\012" "a=control:trackID=%u\015\012", sdpMediaType, payloadNumber, m_trackId); if (include_rtp_map) { buflen += snprintf(sdpBuf + buflen, maxlen - buflen, "a=rtpmap:%u %s\015\012", payloadNumber, rtpMapBuf); } if (include_mpeg4_esid) { snprintf(sdpBuf + buflen, maxlen - buflen, "a=mpeg4-esid:%u\015\012", m_pRefTrack->GetId()); } MP4StringProperty* pSdpProperty = NULL; (void)m_pTrakAtom->FindProperty("trak.udta.hnti.sdp .sdpText", (MP4Property**)&pSdpProperty); ASSERT(pSdpProperty); pSdpProperty->SetValue(sdpBuf); // cleanup MP4Free(rtpMapBuf); MP4Free(sdpBuf); } void MP4RtpHintTrack::AddHint(bool isBFrame, u_int32_t timestampOffset) { // on first hint, need to lookup the reference track if (m_writeHintId == MP4_INVALID_SAMPLE_ID) { InitRefTrack(); InitStats(); } if (m_pWriteHint) { throw new MP4Error("unwritten hint is still pending", "MP4AddRtpHint"); } m_pWriteHint = new MP4RtpHint(this); m_pWriteHint->SetBFrame(isBFrame); m_pWriteHint->SetTimestampOffset(timestampOffset); m_bytesThisHint = 0; m_writeHintId++; } void MP4RtpHintTrack::AddPacket(bool setMbit, int32_t transmitOffset) { if (m_pWriteHint == NULL) { throw new MP4Error("no hint pending", "MP4RtpAddPacket"); } MP4RtpPacket* pPacket = m_pWriteHint->AddPacket(); ASSERT(m_pPayloadNumberProperty); pPacket->Set( m_pPayloadNumberProperty->GetValue(), m_writePacketId++, setMbit); pPacket->SetTransmitOffset(transmitOffset); m_bytesThisHint += 12; if (m_bytesThisPacket > m_pPmax->GetValue()) { m_pPmax->SetValue(m_bytesThisPacket); } m_bytesThisPacket = 12; m_pNump->IncrementValue(); m_pTrpy->IncrementValue(12); // RTP packet header size } void MP4RtpHintTrack::AddImmediateData( const u_int8_t* pBytes, u_int32_t numBytes) { if (m_pWriteHint == NULL) { throw new MP4Error("no hint pending", "MP4RtpAddImmediateData"); } MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); if (pPacket == NULL) { throw new MP4Error("no packet pending", "MP4RtpAddImmediateData"); } if (pBytes == NULL || numBytes == 0) { throw new MP4Error("no data", "AddImmediateData"); } if (numBytes > 14) { throw new MP4Error("data size is larger than 14 bytes", "AddImmediateData"); } MP4RtpImmediateData* pData = new MP4RtpImmediateData(pPacket); pData->Set(pBytes, numBytes); pPacket->AddData(pData); m_bytesThisHint += numBytes; m_bytesThisPacket += numBytes; m_pDimm->IncrementValue(numBytes); m_pTpyl->IncrementValue(numBytes); m_pTrpy->IncrementValue(numBytes); } void MP4RtpHintTrack::AddSampleData( MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength) { if (m_pWriteHint == NULL) { throw new MP4Error("no hint pending", "MP4RtpAddSampleData"); } MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); if (pPacket == NULL) { throw new MP4Error("no packet pending", "MP4RtpAddSampleData"); } MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket); pData->SetReferenceSample(sampleId, dataOffset, dataLength); pPacket->AddData(pData); m_bytesThisHint += dataLength; m_bytesThisPacket += dataLength; m_pDmed->IncrementValue(dataLength); m_pTpyl->IncrementValue(dataLength); m_pTrpy->IncrementValue(dataLength); } void MP4RtpHintTrack::AddESConfigurationPacket() { if (m_pWriteHint == NULL) { throw new MP4Error("no hint pending", "MP4RtpAddESConfigurationPacket"); } u_int8_t* pConfig = NULL; u_int32_t configSize = 0; m_pFile->GetTrackESConfiguration(m_pRefTrack->GetId(), &pConfig, &configSize); if (pConfig == NULL) { return; } ASSERT(m_pMaxPacketSizeProperty); if (configSize > m_pMaxPacketSizeProperty->GetValue()) { throw new MP4Error("ES configuration is too large for RTP payload", "MP4RtpAddESConfigurationPacket"); } AddPacket(false); MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); ASSERT(pPacket); // This is ugly! // To get the ES configuration data somewhere known // we create a sample data reference that points to // this hint track (not the media track) // and this sample of the hint track // the offset into this sample is filled in during the write process MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket); pData->SetEmbeddedImmediate(m_writeSampleId, pConfig, configSize); pPacket->AddData(pData); m_bytesThisHint += configSize; m_bytesThisPacket += configSize; m_pTpyl->IncrementValue(configSize); m_pTrpy->IncrementValue(configSize); } void MP4RtpHintTrack::WriteHint(MP4Duration duration, bool isSyncSample) { if (m_pWriteHint == NULL) { throw new MP4Error("no hint pending", "MP4WriteRtpHint"); } u_int8_t* pBytes; u_int64_t numBytes; m_pFile->EnableMemoryBuffer(); m_pWriteHint->Write(m_pFile); m_pFile->DisableMemoryBuffer(&pBytes, &numBytes); WriteSample(pBytes, numBytes, duration, 0, isSyncSample); MP4Free(pBytes); // update statistics if (m_bytesThisPacket > m_pPmax->GetValue()) { m_pPmax->SetValue(m_bytesThisPacket); } if (duration > m_pDmax->GetValue()) { m_pDmax->SetValue(duration); } MP4Timestamp startTime; GetSampleTimes(m_writeHintId, &startTime, NULL); if (startTime < m_thisSec + GetTimeScale()) { m_bytesThisSec += m_bytesThisHint; } else { if (m_bytesThisSec > m_pMaxr->GetValue()) { m_pMaxr->SetValue(m_bytesThisSec); } m_thisSec = startTime - (startTime % GetTimeScale()); m_bytesThisSec = m_bytesThisHint; } // cleanup delete m_pWriteHint; m_pWriteHint = NULL; } void MP4RtpHintTrack::FinishWrite() { if (m_writeHintId != MP4_INVALID_SAMPLE_ID) { m_pMaxPdu->SetValue(m_pPmax->GetValue()); if (m_pNump->GetValue()) { m_pAvgPdu->SetValue(m_pTrpy->GetValue() / m_pNump->GetValue()); } m_pMaxBitRate->SetValue(m_pMaxr->GetValue() * 8); if (GetDuration()) { m_pAvgBitRate->SetValue( m_pTrpy->GetValue() * 8 * GetTimeScale() / GetDuration()); } } MP4Track::FinishWrite(); } void MP4RtpHintTrack::InitStats() { MP4Atom* pHinfAtom = m_pTrakAtom->FindAtom("trak.udta.hinf"); ASSERT(pHinfAtom); (void)pHinfAtom->FindProperty("hinf.trpy.bytes", (MP4Property**)&m_pTrpy); (void)pHinfAtom->FindProperty("hinf.nump.packets", (MP4Property**)&m_pNump); (void)pHinfAtom->FindProperty("hinf.tpyl.bytes", (MP4Property**)&m_pTpyl); (void)pHinfAtom->FindProperty("hinf.maxr.bytes", (MP4Property**)&m_pMaxr); (void)pHinfAtom->FindProperty("hinf.dmed.bytes", (MP4Property**)&m_pDmed); (void)pHinfAtom->FindProperty("hinf.dimm.bytes", (MP4Property**)&m_pDimm); (void)pHinfAtom->FindProperty("hinf.pmax.bytes", (MP4Property**)&m_pPmax); (void)pHinfAtom->FindProperty("hinf.dmax.milliSecs", (MP4Property**)&m_pDmax); MP4Atom* pHmhdAtom = m_pTrakAtom->FindAtom("trak.mdia.minf.hmhd"); ASSERT(pHmhdAtom); (void)pHmhdAtom->FindProperty("hmhd.maxPduSize", (MP4Property**)&m_pMaxPdu); (void)pHmhdAtom->FindProperty("hmhd.avgPduSize", (MP4Property**)&m_pAvgPdu); (void)pHmhdAtom->FindProperty("hmhd.maxBitRate", (MP4Property**)&m_pMaxBitRate); (void)pHmhdAtom->FindProperty("hmhd.avgBitRate", (MP4Property**)&m_pAvgBitRate); MP4Integer32Property* pMaxrPeriod = NULL; (void)pHinfAtom->FindProperty("hinf.maxr.granularity", (MP4Property**)&pMaxrPeriod); if (pMaxrPeriod) { pMaxrPeriod->SetValue(1000); // 1 second } } MP4RtpHint::MP4RtpHint(MP4RtpHintTrack* pTrack) { m_pTrack = pTrack; AddProperty( /* 0 */ new MP4Integer16Property("packetCount")); AddProperty( /* 1 */ new MP4Integer16Property("reserved")); } MP4RtpHint::~MP4RtpHint() { for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) { delete m_rtpPackets[i]; } } MP4RtpPacket* MP4RtpHint::AddPacket() { MP4RtpPacket* pPacket = new MP4RtpPacket(this); m_rtpPackets.Add(pPacket); // packetCount property ((MP4Integer16Property*)m_pProperties[0])->IncrementValue(); pPacket->SetBFrame(m_isBFrame); pPacket->SetTimestampOffset(m_timestampOffset); return pPacket; } void MP4RtpHint::Read(MP4File* pFile) { // call base class Read for required properties MP4Container::Read(pFile); u_int16_t numPackets = ((MP4Integer16Property*)m_pProperties[0])->GetValue(); for (u_int16_t i = 0; i < numPackets; i++) { MP4RtpPacket* pPacket = new MP4RtpPacket(this); m_rtpPackets.Add(pPacket); pPacket->Read(pFile); } VERBOSE_READ_HINT(pFile->GetVerbosity(), printf("ReadHint:\n"); Dump(stdout, 10, false);); } void MP4RtpHint::Write(MP4File* pFile) { u_int64_t hintStartPos = pFile->GetPosition(); MP4Container::Write(pFile); u_int64_t packetStartPos = pFile->GetPosition(); u_int32_t i; // first write out packet (and data) entries for (i = 0; i < m_rtpPackets.Size(); i++) { m_rtpPackets[i]->Write(pFile); } // now let packets write their extra data into the hint sample for (i = 0; i < m_rtpPackets.Size(); i++) { m_rtpPackets[i]->WriteEmbeddedData(pFile, hintStartPos); } u_int64_t endPos = pFile->GetPosition(); pFile->SetPosition(packetStartPos); // finally rewrite the packet and data entries // which now contain the correct offsets for the embedded data for (i = 0; i < m_rtpPackets.Size(); i++) { m_rtpPackets[i]->Write(pFile); } pFile->SetPosition(endPos); VERBOSE_WRITE_HINT(pFile->GetVerbosity(), printf("WriteRtpHint:\n"); Dump(stdout, 14, false)); } void MP4RtpHint::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) { MP4Container::Dump(pFile, indent, dumpImplicits); for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) { Indent(pFile, indent); fprintf(pFile, "RtpPacket: %u\n", i); m_rtpPackets[i]->Dump(pFile, indent + 1, dumpImplicits); } } MP4RtpPacket::MP4RtpPacket(MP4RtpHint* pHint) { m_pHint = pHint; AddProperty( /* 0 */ new MP4Integer32Property("relativeXmitTime")); AddProperty( /* 1 */ new MP4BitfieldProperty("reserved1", 2)); AddProperty( /* 2 */ new MP4BitfieldProperty("Pbit", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("Xbit", 1)); AddProperty( /* 4 */ new MP4BitfieldProperty("reserved2", 4)); AddProperty( /* 5 */ new MP4BitfieldProperty("Mbit", 1)); AddProperty( /* 6 */ new MP4BitfieldProperty("payloadType", 7)); AddProperty( /* 7 */ new MP4Integer16Property("sequenceNumber")); AddProperty( /* 8 */ new MP4BitfieldProperty("reserved3", 13)); AddProperty( /* 9 */ new MP4BitfieldProperty("extraFlag", 1)); AddProperty( /* 10 */ new MP4BitfieldProperty("bFrameFlag", 1)); AddProperty( /* 11 */ new MP4BitfieldProperty("repeatFlag", 1)); AddProperty( /* 12 */ new MP4Integer16Property("entryCount")); } MP4RtpPacket::~MP4RtpPacket() { for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { delete m_rtpData[i]; } } void MP4RtpPacket::AddExtraProperties() { AddProperty( /* 13 */ new MP4Integer32Property("extraInformationLength")); // This is a bit of a hack, since the tlv entries are really defined // as atoms but there is only one type defined now, rtpo, and getting // our atom code hooked up here would be a major pain with little gain AddProperty( /* 14 */ new MP4Integer32Property("tlvLength")); AddProperty( /* 15 */ new MP4StringProperty("tlvType")); AddProperty( /* 16 */ new MP4Integer32Property("timestampOffset")); ((MP4Integer32Property*)m_pProperties[13])->SetValue(16); ((MP4Integer32Property*)m_pProperties[14])->SetValue(12); ((MP4StringProperty*)m_pProperties[15])->SetFixedLength(4); ((MP4StringProperty*)m_pProperties[15])->SetValue("rtpo"); } void MP4RtpPacket::Read(MP4File* pFile) { // call base class Read for required properties MP4Container::Read(pFile); // read extra info if present // we only support the rtpo field! if (((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 1) { ReadExtra(pFile); } u_int16_t numDataEntries = ((MP4Integer16Property*)m_pProperties[12])->GetValue(); // read data entries for (u_int16_t i = 0; i < numDataEntries; i++) { u_int8_t dataType; pFile->PeekBytes(&dataType, 1); MP4RtpData* pData; switch (dataType) { case 0: pData = new MP4RtpNullData(this); break; case 1: pData = new MP4RtpImmediateData(this); break; case 2: pData = new MP4RtpSampleData(this); break; case 3: pData = new MP4RtpSampleDescriptionData(this); break; default: throw new MP4Error("unknown packet data entry type", "MP4ReadHint"); } m_rtpData.Add(pData); // read data entry's properties pData->Read(pFile); } } void MP4RtpPacket::ReadExtra(MP4File* pFile) { AddExtraProperties(); int32_t extraLength = (int32_t)pFile->ReadUInt32(); if (extraLength < 4) { throw new MP4Error("bad packet extra info length", "MP4RtpPacket::ReadExtra"); } extraLength -= 4; while (extraLength > 0) { u_int32_t entryLength = pFile->ReadUInt32(); u_int32_t entryTag = pFile->ReadUInt32(); if (entryLength < 8) { throw new MP4Error("bad packet extra info entry length", "MP4RtpPacket::ReadExtra"); } if (entryTag == STRTOINT32("rtpo") && entryLength == 12) { // read the rtp timestamp offset m_pProperties[16]->Read(pFile); } else { // ignore it, LATER carry it along pFile->SetPosition(pFile->GetPosition() + entryLength - 8); } extraLength -= entryLength; } if (extraLength < 0) { throw new MP4Error("invalid packet extra info length", "MP4RtpPacket::ReadExtra"); } } void MP4RtpPacket::Set(u_int8_t payloadNumber, u_int32_t packetId, bool setMbit) { ((MP4BitfieldProperty*)m_pProperties[5])->SetValue(setMbit); ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(payloadNumber); ((MP4Integer16Property*)m_pProperties[7])->SetValue(packetId); } int32_t MP4RtpPacket::GetTransmitOffset() { return ((MP4Integer32Property*)m_pProperties[0])->GetValue(); } void MP4RtpPacket::SetTransmitOffset(int32_t transmitOffset) { ((MP4Integer32Property*)m_pProperties[0])->SetValue(transmitOffset); } bool MP4RtpPacket::GetPBit() { return ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); } bool MP4RtpPacket::GetXBit() { return ((MP4BitfieldProperty*)m_pProperties[3])->GetValue(); } bool MP4RtpPacket::GetMBit() { return ((MP4BitfieldProperty*)m_pProperties[5])->GetValue(); } u_int8_t MP4RtpPacket::GetPayload() { return ((MP4BitfieldProperty*)m_pProperties[6])->GetValue(); } u_int16_t MP4RtpPacket::GetSequenceNumber() { return ((MP4Integer16Property*)m_pProperties[7])->GetValue(); } bool MP4RtpPacket::IsBFrame() { return ((MP4BitfieldProperty*)m_pProperties[10])->GetValue(); } void MP4RtpPacket::SetBFrame(bool isBFrame) { ((MP4BitfieldProperty*)m_pProperties[10])->SetValue(isBFrame); } void MP4RtpPacket::SetTimestampOffset(u_int32_t timestampOffset) { if (timestampOffset == 0) { return; } ASSERT(((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 0); // set X bit ((MP4BitfieldProperty*)m_pProperties[9])->SetValue(1); AddExtraProperties(); ((MP4Integer32Property*)m_pProperties[16])->SetValue(timestampOffset); } void MP4RtpPacket::AddData(MP4RtpData* pData) { m_rtpData.Add(pData); // increment entry count property ((MP4Integer16Property*)m_pProperties[12])->IncrementValue(); } u_int32_t MP4RtpPacket::GetDataSize() { u_int32_t totalDataSize = 0; for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { totalDataSize += m_rtpData[i]->GetDataSize(); } return totalDataSize; } void MP4RtpPacket::GetData(u_int8_t* pDest) { for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { m_rtpData[i]->GetData(pDest); pDest += m_rtpData[i]->GetDataSize(); } } void MP4RtpPacket::Write(MP4File* pFile) { MP4Container::Write(pFile); for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { m_rtpData[i]->Write(pFile); } } void MP4RtpPacket::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) { for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { m_rtpData[i]->WriteEmbeddedData(pFile, startPos); } } void MP4RtpPacket::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) { MP4Container::Dump(pFile, indent, dumpImplicits); for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { Indent(pFile, indent); fprintf(pFile, "RtpData: %u\n", i); m_rtpData[i]->Dump(pFile, indent + 1, dumpImplicits); } } MP4RtpData::MP4RtpData(MP4RtpPacket* pPacket) { m_pPacket = pPacket; AddProperty( /* 0 */ new MP4Integer8Property("type")); } MP4Track* MP4RtpData::FindTrackFromRefIndex(u_int8_t refIndex) { MP4Track* pTrack; if (refIndex == (u_int8_t)-1) { // ourselves pTrack = GetPacket()->GetHint()->GetTrack(); } else if (refIndex == 0) { // our reference track pTrack = GetPacket()->GetHint()->GetTrack()->GetRefTrack(); } else { // some other track MP4RtpHintTrack* pHintTrack = GetPacket()->GetHint()->GetTrack(); MP4Atom* pTrakAtom = pHintTrack->GetTrakAtom(); ASSERT(pTrakAtom); MP4Integer32Property* pTrackIdProperty = NULL; (void)pTrakAtom->FindProperty( "trak.tref.hint.entries", (MP4Property**)&pTrackIdProperty); ASSERT(pTrackIdProperty); u_int32_t refTrackId = pTrackIdProperty->GetValue(refIndex - 1); pTrack = pHintTrack->GetFile()->GetTrack(refTrackId); } return pTrack; } MP4RtpNullData::MP4RtpNullData(MP4RtpPacket* pPacket) : MP4RtpData(pPacket) { ((MP4Integer8Property*)m_pProperties[0])->SetValue(0); AddProperty( /* 1 */ new MP4BytesProperty("pad", 15)); ((MP4BytesProperty*)m_pProperties[1])->SetFixedSize(15); } MP4RtpImmediateData::MP4RtpImmediateData(MP4RtpPacket* pPacket) : MP4RtpData(pPacket) { ((MP4Integer8Property*)m_pProperties[0])->SetValue(1); AddProperty( /* 1 */ new MP4Integer8Property("count")); AddProperty( /* 2 */ new MP4BytesProperty("data", 14)); ((MP4BytesProperty*)m_pProperties[2])->SetFixedSize(14); } void MP4RtpImmediateData::Set(const u_int8_t* pBytes, u_int8_t numBytes) { ((MP4Integer8Property*)m_pProperties[1])->SetValue(numBytes); ((MP4BytesProperty*)m_pProperties[2])->SetValue(pBytes, numBytes); } u_int16_t MP4RtpImmediateData::GetDataSize() { return ((MP4Integer8Property*)m_pProperties[1])->GetValue(); } void MP4RtpImmediateData::GetData(u_int8_t* pDest) { u_int8_t* pValue; u_int32_t valueSize; ((MP4BytesProperty*)m_pProperties[2])->GetValue(&pValue, &valueSize); memcpy(pDest, pValue, GetDataSize()); MP4Free(pValue); } MP4RtpSampleData::MP4RtpSampleData(MP4RtpPacket* pPacket) : MP4RtpData(pPacket) { ((MP4Integer8Property*)m_pProperties[0])->SetValue(2); AddProperty( /* 1 */ new MP4Integer8Property("trackRefIndex")); AddProperty( /* 2 */ new MP4Integer16Property("length")); AddProperty( /* 3 */ new MP4Integer32Property("sampleNumber")); AddProperty( /* 4 */ new MP4Integer32Property("sampleOffset")); AddProperty( /* 5 */ new MP4Integer16Property("bytesPerBlock")); AddProperty( /* 6 */ new MP4Integer16Property("samplesPerBlock")); ((MP4Integer16Property*)m_pProperties[5])->SetValue(1); ((MP4Integer16Property*)m_pProperties[6])->SetValue(1); m_pRefData = NULL; m_pRefTrack = NULL; m_refSampleId = MP4_INVALID_SAMPLE_ID; m_refSampleOffset = 0; } void MP4RtpSampleData::SetEmbeddedImmediate(MP4SampleId sampleId, u_int8_t* pData, u_int16_t dataLength) { ((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1); ((MP4Integer16Property*)m_pProperties[2])->SetValue(dataLength); ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId); ((MP4Integer32Property*)m_pProperties[4])->SetValue(0); CHECK_AND_FREE(m_pRefData); m_pRefData = pData; } void MP4RtpSampleData::SetReferenceSample( MP4SampleId refSampleId, u_int32_t refSampleOffset, u_int16_t sampleLength) { ((MP4Integer8Property*)m_pProperties[1])->SetValue(0); ((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength); ((MP4Integer32Property*)m_pProperties[3])->SetValue(refSampleId); ((MP4Integer32Property*)m_pProperties[4])->SetValue(refSampleOffset); } void MP4RtpSampleData::SetEmbeddedSample( MP4SampleId sampleId, MP4Track* pRefTrack, MP4SampleId refSampleId, u_int32_t refSampleOffset, u_int16_t sampleLength) { ((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1); ((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength); ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId); ((MP4Integer32Property*)m_pProperties[4])->SetValue(0); m_pRefTrack = pRefTrack; m_refSampleId = refSampleId; m_refSampleOffset = refSampleOffset; } u_int16_t MP4RtpSampleData::GetDataSize() { return ((MP4Integer16Property*)m_pProperties[2])->GetValue(); } void MP4RtpSampleData::GetData(u_int8_t* pDest) { u_int8_t trackRefIndex = ((MP4Integer8Property*)m_pProperties[1])->GetValue(); MP4Track* pSampleTrack = FindTrackFromRefIndex(trackRefIndex); pSampleTrack->ReadSampleFragment( ((MP4Integer32Property*)m_pProperties[3])->GetValue(), // sampleId ((MP4Integer32Property*)m_pProperties[4])->GetValue(), // sampleOffset ((MP4Integer16Property*)m_pProperties[2])->GetValue(), // sampleLength pDest); } void MP4RtpSampleData::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) { // if not using embedded data, nothing to do if (((MP4Integer8Property*)m_pProperties[1])->GetValue() != (u_int8_t)-1) { return; } // figure out the offset within this hint sample for this embedded data u_int64_t offset = pFile->GetPosition() - startPos; ASSERT(offset <= 0xFFFFFFFF); ((MP4Integer32Property*)m_pProperties[4])->SetValue((u_int32_t)offset); u_int16_t length = ((MP4Integer16Property*)m_pProperties[2])->GetValue(); if (m_pRefData) { pFile->WriteBytes(m_pRefData, length); return; } if (m_refSampleId != MP4_INVALID_SAMPLE_ID) { u_int8_t* pSample = NULL; u_int32_t sampleSize = 0; ASSERT(m_pRefTrack); m_pRefTrack->ReadSample(m_refSampleId, &pSample, &sampleSize); ASSERT(m_refSampleOffset + length <= sampleSize); pFile->WriteBytes(&pSample[m_refSampleOffset], length); MP4Free(pSample); return; } } MP4RtpSampleDescriptionData::MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket) : MP4RtpData(pPacket) { ((MP4Integer8Property*)m_pProperties[0])->SetValue(3); AddProperty( /* 1 */ new MP4Integer8Property("trackRefIndex")); AddProperty( /* 2 */ new MP4Integer16Property("length")); AddProperty( /* 3 */ new MP4Integer32Property("sampleDescriptionIndex")); AddProperty( /* 4 */ new MP4Integer32Property("sampleDescriptionOffset")); AddProperty( /* 5 */ new MP4Integer32Property("reserved")); } void MP4RtpSampleDescriptionData::Set(u_int32_t sampleDescrIndex, u_int32_t offset, u_int16_t length) { ((MP4Integer16Property*)m_pProperties[2])->SetValue(length); ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleDescrIndex); ((MP4Integer32Property*)m_pProperties[4])->SetValue(offset); } u_int16_t MP4RtpSampleDescriptionData::GetDataSize() { return ((MP4Integer16Property*)m_pProperties[2])->GetValue(); } void MP4RtpSampleDescriptionData::GetData(u_int8_t* pDest) { // we start with the index into our track references u_int8_t trackRefIndex = ((MP4Integer8Property*)m_pProperties[1])->GetValue(); // from which we can find the track structure MP4Track* pSampleTrack = FindTrackFromRefIndex(trackRefIndex); // next find the desired atom in the track's sample description table u_int32_t sampleDescrIndex = ((MP4Integer32Property*)m_pProperties[3])->GetValue(); MP4Atom* pTrakAtom = pSampleTrack->GetTrakAtom(); char sdName[64]; snprintf(sdName, 64, "trak.mdia.minf.stbl.stsd.*[%u]", sampleDescrIndex); MP4Atom* pSdAtom = pTrakAtom->FindAtom(sdName); // bad reference if (pSdAtom == NULL) { throw new MP4Error("invalid sample description index", "MP4RtpSampleDescriptionData::GetData"); } // check validity of the upcoming copy u_int16_t length = ((MP4Integer16Property*)m_pProperties[2])->GetValue(); u_int32_t offset = ((MP4Integer32Property*)m_pProperties[4])->GetValue(); if (offset + length > pSdAtom->GetSize()) { throw new MP4Error("offset and/or length are too large", "MP4RtpSampleDescriptionData::GetData"); } // now we use the raw file to get the desired bytes MP4File* pFile = GetPacket()->GetHint()->GetTrack()->GetFile(); u_int64_t orgPos = pFile->GetPosition(); // It's not entirely clear from the spec whether the offset is from // the start of the sample descirption atom, or the start of the atom's // data. I believe it is the former, but the commented out code will // realize the latter interpretation if I turn out to be wrong. u_int64_t dataPos = pSdAtom->GetStart(); //u_int64_t dataPos = pSdAtom->GetEnd() - pSdAtom->GetSize(); pFile->SetPosition(dataPos + offset); pFile->ReadBytes(pDest, length); pFile->SetPosition(orgPos); } faac-1.28/common/mp4v2/rtphint.h0000644010307701030770000001651110101411050020130 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com */ #ifndef __RTPHINT_INCLUDED__ #define __RTPHINT_INCLUDED__ // forward declarations class MP4RtpHintTrack; class MP4RtpHint; class MP4RtpPacket; class MP4RtpData : public MP4Container { public: MP4RtpData(MP4RtpPacket* pPacket); MP4RtpPacket* GetPacket() { return m_pPacket; } virtual u_int16_t GetDataSize() = 0; virtual void GetData(u_int8_t* pDest) = 0; MP4Track* FindTrackFromRefIndex(u_int8_t refIndex); virtual void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) { // default is no-op } protected: MP4RtpPacket* m_pPacket; }; MP4ARRAY_DECL(MP4RtpData, MP4RtpData*) class MP4RtpNullData : public MP4RtpData { public: MP4RtpNullData(MP4RtpPacket* pPacket); u_int16_t GetDataSize() { return 0; } void GetData(u_int8_t* pDest) { // no-op } }; class MP4RtpImmediateData : public MP4RtpData { public: MP4RtpImmediateData(MP4RtpPacket* pPacket); void Set(const u_int8_t* pBytes, u_int8_t numBytes); u_int16_t GetDataSize(); void GetData(u_int8_t* pDest); }; class MP4RtpSampleData : public MP4RtpData { public: MP4RtpSampleData(MP4RtpPacket* pPacket); ~MP4RtpSampleData(void) { CHECK_AND_FREE(m_pRefData); }; void SetEmbeddedImmediate( MP4SampleId sampleId, u_int8_t* pData, u_int16_t dataLength); void SetReferenceSample( MP4SampleId refSampleId, u_int32_t refSampleOffset, u_int16_t sampleLength); void SetEmbeddedSample( MP4SampleId sampleId, MP4Track* pRefTrack, MP4SampleId refSampleId, u_int32_t refSampleOffset, u_int16_t sampleLength); u_int16_t GetDataSize(); void GetData(u_int8_t* pDest); void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos); protected: u_int8_t* m_pRefData; MP4Track* m_pRefTrack; MP4SampleId m_refSampleId; u_int32_t m_refSampleOffset; }; class MP4RtpSampleDescriptionData : public MP4RtpData { public: MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket); void Set(u_int32_t sampleDescrIndex, u_int32_t offset, u_int16_t length); u_int16_t GetDataSize(); void GetData(u_int8_t* pDest); }; class MP4RtpPacket : public MP4Container { public: MP4RtpPacket(MP4RtpHint* pHint); ~MP4RtpPacket(); void AddExtraProperties(); MP4RtpHint* GetHint() { return m_pHint; } void Set(u_int8_t payloadNumber, u_int32_t packetId, bool setMbit); int32_t GetTransmitOffset(); bool GetPBit(); bool GetXBit(); bool GetMBit(); u_int8_t GetPayload(); u_int16_t GetSequenceNumber(); void SetTransmitOffset(int32_t transmitOffset); bool IsBFrame(); void SetBFrame(bool isBFrame); void SetTimestampOffset(u_int32_t timestampOffset); void AddData(MP4RtpData* pData); u_int32_t GetDataSize(); void GetData(u_int8_t* pDest); void Read(MP4File* pFile); void ReadExtra(MP4File* pFile); void Write(MP4File* pFile); void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); protected: MP4RtpHint* m_pHint; MP4RtpDataArray m_rtpData; }; MP4ARRAY_DECL(MP4RtpPacket, MP4RtpPacket*) class MP4RtpHint : public MP4Container { public: MP4RtpHint(MP4RtpHintTrack* pTrack); ~MP4RtpHint(); MP4RtpHintTrack* GetTrack() { return m_pTrack; } u_int16_t GetNumberOfPackets() { return m_rtpPackets.Size(); } bool IsBFrame() { return m_isBFrame; } void SetBFrame(bool isBFrame) { m_isBFrame = isBFrame; } u_int32_t GetTimestampOffset() { return m_timestampOffset; } void SetTimestampOffset(u_int32_t timestampOffset) { m_timestampOffset = timestampOffset; } MP4RtpPacket* AddPacket(); MP4RtpPacket* GetPacket(u_int16_t index) { return m_rtpPackets[index]; } MP4RtpPacket* GetCurrentPacket() { if (m_rtpPackets.Size() == 0) { return NULL; } return m_rtpPackets[m_rtpPackets.Size() - 1]; } void Read(MP4File* pFile); void Write(MP4File* pFile); void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); protected: MP4RtpHintTrack* m_pTrack; MP4RtpPacketArray m_rtpPackets; // values when adding packets to a hint (write mode) bool m_isBFrame; u_int32_t m_timestampOffset; }; class MP4RtpHintTrack : public MP4Track { public: MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom); ~MP4RtpHintTrack(); void InitRefTrack(); void InitPayload(); void InitRtpStart(); void InitStats(); MP4Track* GetRefTrack() { InitRefTrack(); return m_pRefTrack; } void GetPayload( char** ppPayloadName = NULL, u_int8_t* pPayloadNumber = NULL, u_int16_t* pMaxPayloadSize = NULL, char **ppEncodingParams = NULL); void SetPayload( const char* payloadName, u_int8_t payloadNumber, u_int16_t maxPayloadSize, const char *encoding_parms, bool add_rtpmap, bool add_mpeg4_esid); void ReadHint( MP4SampleId hintSampleId, u_int16_t* pNumPackets = NULL); u_int16_t GetHintNumberOfPackets(); bool GetPacketBFrame(u_int16_t packetIndex); u_int16_t GetPacketTransmitOffset(u_int16_t packetIndex); void ReadPacket( u_int16_t packetIndex, u_int8_t** ppBytes, u_int32_t* pNumBytes, u_int32_t ssrc, bool includeHeader = true, bool includePayload = true); MP4Timestamp GetRtpTimestampStart(); void SetRtpTimestampStart(MP4Timestamp start); void AddHint(bool isBFrame, u_int32_t timestampOffset); void AddPacket(bool setMbit, int32_t transmitOffset = 0); void AddImmediateData(const u_int8_t* pBytes, u_int32_t numBytes); void AddSampleData(MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength); void AddESConfigurationPacket(); void WriteHint(MP4Duration duration, bool isSyncSample); void FinishWrite(); protected: MP4Track* m_pRefTrack; MP4StringProperty* m_pRtpMapProperty; MP4Integer32Property* m_pPayloadNumberProperty; MP4Integer32Property* m_pMaxPacketSizeProperty; MP4Integer32Property* m_pSnroProperty; MP4Integer32Property* m_pTsroProperty; u_int32_t m_rtpSequenceStart; u_int32_t m_rtpTimestampStart; // reading MP4RtpHint* m_pReadHint; u_int8_t* m_pReadHintSample; u_int32_t m_readHintSampleSize; MP4Timestamp m_readHintTimestamp; // writing MP4RtpHint* m_pWriteHint; MP4SampleId m_writeHintId; u_int32_t m_writePacketId; // statistics // in trak.udta.hinf MP4Integer64Property* m_pTrpy; MP4Integer64Property* m_pNump; MP4Integer64Property* m_pTpyl; MP4Integer32Property* m_pMaxr; MP4Integer64Property* m_pDmed; MP4Integer64Property* m_pDimm; MP4Integer32Property* m_pPmax; MP4Integer32Property* m_pDmax; // in trak.mdia.minf.hmhd MP4Integer16Property* m_pMaxPdu; MP4Integer16Property* m_pAvgPdu; MP4Integer32Property* m_pMaxBitRate; MP4Integer32Property* m_pAvgBitRate; MP4Timestamp m_thisSec; u_int32_t m_bytesThisSec; u_int32_t m_bytesThisHint; u_int32_t m_bytesThisPacket; }; #endif /* __RTPHINT_INCLUDED__ */ faac-1.28/common/mp4v2/virtual_io.cpp0000755010307701030770000000407311136736372021205 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * Contributor(s): * Ben Allison benski at nullsoft.com * * Virtual I/O support, for file support other than fopen/fread/fwrite */ #include "mp4common.h" #include "virtual_io.h" /* --------- Virtual IO for FILE * --------- */ u_int64_t FILE_GetFileLength(void *user) { FILE *fp = (FILE *)user; struct stat s; if (fstat(fileno(fp), &s) < 0) { throw new MP4Error(errno, "stat failed", "MP4Open"); } return s.st_size; } int FILE_SetPosition(void *user, u_int64_t position) { FILE *fp = (FILE *)user; fpos_t fpos; VAR_TO_FPOS(fpos, position); return fsetpos(fp, &fpos); } int FILE_GetPosition(void *user, u_int64_t *position) { FILE *fp = (FILE *)user; fpos_t fpos; if (fgetpos(fp, &fpos) < 0) { throw new MP4Error(errno, "MP4GetPosition"); } FPOS_TO_VAR(fpos, u_int64_t, *position); return 0; } size_t FILE_Read(void *user, void *buffer, size_t size) { FILE *fp = (FILE *)user; return fread(buffer, 1, size, fp); } size_t FILE_Write(void *user, void *buffer, size_t size) { FILE *fp = (FILE *)user; return fwrite(buffer, 1, size, fp); } int FILE_EndOfFile(void *user) { FILE *fp = (FILE *)user; return feof(fp); } int FILE_Close(void *user) { FILE *fp = (FILE *)user; return fclose(fp); } Virtual_IO FILE_virtual_IO = { FILE_GetFileLength, FILE_SetPosition, FILE_GetPosition, FILE_Read, FILE_Write, FILE_EndOfFile, FILE_Close, }; faac-1.28/common/mp4v2/virtual_io.h0000755010307701030770000000173311136736372020652 0ustar fabian-guestfabian-guest/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * Contributor(s): * Ben Allison benski at nullsoft.com * * Virtual I/O support, for file support other than fopen/fread/fwrite */ #ifndef __VIRTUAL_IO_INCLUDED__ #define __VIRTUAL_IO_INCLUDED__ #include "mpeg4ip.h" extern Virtual_IO FILE_virtual_IO; #endif faac-1.28/common/Makefile.in0000644010307701030770000003335311144236254017412 0ustar fabian-guestfabian-guest# 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 = common DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/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 = mp4v2 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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@ @WITH_MP4V2_FALSE@SUBDIRS = @WITH_MP4V2_TRUE@SUBDIRS = mp4v2 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) --gnu common/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu common/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: faac-1.28/AUTHORS0000644010307701030770000000235410134545131015115 0ustar fabian-guestfabian-guestCurrently maintained by menno (menno@audiocoding.com). The following list contains the user names of all FAAC developers with their first appearance in the ChangeLog: 1999-12-13 lenox (Tony Lenox) 1999-12-13 menno 2000-02-07 oxygene2000/oxygene (?) 2000-02-22 thebard (wmilas@rarcoa.com) 2000-07-22 prkoat (?) 2001-03-18 xfhobbes (?) 2001-04-27 flyingfox (?) 2001-09-21 eraser (?) 2002-08-07 knik (Krzysztof Nikiel) 2003-08-02 stux (Stuart Espey) 2003-09-07 ca5e (Janne Hyvrinen) 2004-03-17 danchr (Dan Christiansen) 2004-07-04 corrados (Volker Fischer) Furthermore there are other contributors from the SourceForge mailing list and trackers as well as from the web forum or via email whose patches were checked in by members of the FAAC project. Among them are Antonio Foranna (Winamp and CoolEdit plugins), Bill May, Stephen Shultz (sms00), Jordan Breeding, Brandon Forehand, Andrew Voznytsa, Mns Rullgrd, RageOMatic and Ivan Dimkovic. You can find their names and/or aliases in the ChangeLog most of the time. Question marks mean that neither the real name nor the email address is known. If you think your name should also be in this list or know who some of the early developers are, please email me: hans-juergen.bardenhagen@arcor.de faac-1.28/COPYING0000644010307701030770000006131407305132744015111 0ustar fabian-guestfabian-guest GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 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. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] 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 Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, 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 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 a program 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. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, 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 companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. 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, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library 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 compile 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) 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. c) 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. d) 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 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. 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 to 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 Library 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. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library 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. 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! faac-1.28/ChangeLog0000644010307701030770000000040611141700735015615 0ustar fabian-guestfabian-guest2009-02-02 - Version 1.28 * Prevent out of range scalefactors * Updated to latest mpeg4ip mp4 file format library * Added -s option to make the encoder output optimized mp4 layout * Improved JPEG detection for album art * Lot's of compilation issues solved faac-1.28/INSTALL0000644010307701030770000002243211144236255015103 0ustar fabian-guestfabian-guestInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. faac-1.28/Makefile.am0000644010307701030770000000005210101660514016067 0ustar fabian-guestfabian-guestSUBDIRS = include libfaac common frontend faac-1.28/NEWS0000644010307701030770000000354310134545132014546 0ustar fabian-guestfabian-guestD'oh! ;-) The most important news in the last weeks probably was moving libmp4v2 from FAAD2 to the FAAC folder in the currently available snapshots on Audiocoding.com and in the CVS. So FAAC doesn't need an installed FAAD2 anymore if it is compiled with MP4 writing and tagging support. Yes, FAAC can do that on its own now, thanks to Dan and Case... Volker Fischer adapted FAAC to Digital Radio Mondiale, i.e. it works as an AAC LC encoder in his DReaM receiver/transmitter software now. There are still things to straighten out like the frame length, but these test transmissions can be decoded by the official DRM receiver from FhG/Merlin, too. There's a new FAAC project summary on Freshmeat.net with many links to existing ports and packages as well as other applications using either FAAC or FAAD2: http://freshmeat.net/projects/faac/ And Audiocoding.com has been added to the Open Directory Project on dmoz.org, too, which serves as a database for many important search engines, e.g. Google, Yahoo, AOL and others. The Winamp and CoolEdit output plugins by Antonio Foranna have been updated quite often recently (MP4 tagging and importing tags from input files), and he'll probably be an official project member soon. By the way, the currently available compiles on RareWares need the external id3lib.dll in your system directory, otherwise they won't show up in Winamp's output plugins folder. CoolEdit even quits with an error message at the start. Sad news was that knik quit developing FAAC after bringing it to its current competitive state which was proven in the last AAC comparison from 2004 on http://www.rjamorim.com/test/aac128v2/results.html So if someone out there feels like tuning the only available open source AAC encoder, go ahead... Hans-Juergen (Oct 17, 2004) P.S.: See also the updated ChangeLog for all changes since the last ChangeLog from Nov 24, 2003. faac-1.28/README0000644010307701030770000000572710134545132014735 0ustar fabian-guestfabian-guest__________ COPYRIGHTS FAAC is based on the ISO MPEG-4 reference code. For this base code the following license applies: ********************************************************************** This software module was originally developed by FirstName LastName (CompanyName) and edited by FirstName LastName (CompanyName) FirstName LastName (CompanyName) in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1997. ********************************************************************** For the changes made for the FAAC project the GNU Library General Public License (LGPL), version 2 1991 applies. For the changes the following statement applies: ********************************************************************** FAAC - Freeware Advanced Audio Coder Copyright (C) 2001 M. Bakker 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 ********************************************************************** Please note that the use of this software may require the payment of patent royalties. You need to consider this issue before you start building derivative works. We are not warranting or indemnifying you in any way for patent royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!faac-1.28/TODO0000644010307701030770000000267610134545132014545 0ustar fabian-guestfabian-guestTODO: In any order Big list, but a lot of it can be done fairly easily with some old code. Note: most of these issues are quite old, and it's not clear who submitted them in this file and why and/or if some of them are fixed in the meantime. The ChangeLog might give some insight on this though. - DONE: Add frequency cutoff filter - DONE: Add ADTS headers - DONE: Write GUI - DONE: Add TNS - DONE: Add LTP - DONE: Add backward prediction (MPEG2-AAC)???? - DONE: Test (and maybe fix) sample rates other than 44100 Hz - DONE: Test (and maybe fix) multichannel and mono support - DONE: Figure out how to read and write ".mp4" format - DONE: Write documentation for library interface - DONE: Improve command line tool - DONE: VBR quantizer - DONE: Speedup - Done: Clean up psychoacoustics code - Done: Add Window shape switching - Add PNS - Add IS - Add bit reservoir control - Add pulse coding (?) - Rewrite noiseless coding (now taken from old version) (?) - Better grouping support (?) - Fix short block psychoacoustics (?) - Fix TNS (hans-juergen, Oct 17, 2004) - Fix LTP (hans-juergen, Oct 17, 2004) - Fix Main (hans-juergen, Oct 17, 2004) - Add resampler and downmixer (hans-juergen, Oct 17, 2004) - Add HE AAC (hans-juergen, Oct 17, 2004) - Fix mysterious crash/freeze with some decoded WAV files on Linux: endianness? TNS? M/S? decoder bug? (hans-juergen, Oct 17, 2004) - Fix default ABR cutoff frequencies at different bitrates (hans-juergen, Oct 17, 2004) faac-1.28/bootstrap0000755010307701030770000000024510101660514016002 0ustar fabian-guestfabian-guest#! /bin/sh aclocal -I . autoheader if test "`uname -s`" = Darwin; then glibtoolize --automake else libtoolize --automake fi automake --add-missing autoconf faac-1.28/configure.in0000644010307701030770000000434511142434412016357 0ustar fabian-guestfabian-guestAC_PREREQ(2.50) AC_INIT(FAAC, 1.28, faac-dev@lists.sourceforge.net) AC_CONFIG_AUX_DIR(.) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) AC_ARG_WITH( mp4v2, [ --with-mp4v2 compile libmp4v2],WITHMP4V2=$withval, WITHMP4V2=yes) AC_ARG_ENABLE( drm, [ --enable-drm Digital Radio Mondiale support], enable_drm=$enableval, enable_drm=no) AC_DEFUN([MY_DEFINE], [ AC_DEFINE($1, 1, [define if needed]) ]) CFLAGS=${CFLAGS:-"-O2 -Wall"} AC_PROG_CC AC_PROG_CXX AM_PROG_LIBTOOL AC_CHECK_HEADERS(getopt.h) AC_CHECK_TYPES(u_int32_t) AC_CHECK_TYPES(u_int16_t) AC_CHECK_TYPES(int32_t) AC_CHECK_TYPES(int16_t) AC_CHECK_DECL(strcasecmp, MY_DEFINE(HAVE_STRCASECMP)) AC_CHECK_LIB(gnugetopt, getopt_long) AM_CONDITIONAL(WITH_MP4V2, false) AC_CHECK_DECLS([MP4Create, MP4MetadataDelete], AC_CHECK_LIB(mp4v2, MP4MetadataDelete, external_mp4v2=yes, external_mp4v2=no, -lstdc++), external_mp4v2=no, [#include ]) if test x$external_mp4v2 = xyes; then AC_MSG_NOTICE([*** Building with external mp4v2 ***]) else if test x$WITHMP4V2 = xyes; then AC_MSG_NOTICE([*** Building with internal mp4v2 ***]) AM_CONDITIONAL(WITH_MP4V2, true) AC_CONFIG_LINKS(common/mp4v2/mpeg4ip_config.h:config.h) MY_DEFINE(HAVE_LIBMP4V2) else AC_MSG_NOTICE([*** Building WITHOUT mp4v2 ***]) fi fi dnl Check for DRM mode if test "x$enable_drm" = "xyes"; then AC_DEFINE(DRM, 1, [Define if you want to encode for DRM]) AM_CONDITIONAL(USE_DRM, true) CFLAGS="$CFLAGS -DDRM" else AM_CONDITIONAL(USE_DRM, false) fi AC_C_BIGENDIAN dnl Checks for header files required for mp4.h AC_HEADER_STDC AC_SYS_LARGEFILE AC_CHECK_HEADERS(stdint.h inttypes.h) AC_CHECK_HEADERS(mathf.h) AC_CHECK_HEADERS(float.h) AC_CHECK_DECL(strchr, MY_DEFINE(HAVE_STRCHR)) AC_CHECK_DECL(memcpy, MY_DEFINE(HAVE_MEMCPY)) AC_CHECK_DECL(strsep, MY_DEFINE(HAVE_STRSEP)) AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME AC_TYPE_OFF_T AC_CHECK_TYPES([in_port_t, socklen_t], , , [#include #include #include ]) AC_CHECK_MEMBERS(fpos_t.__pos,,, [#include ]) AC_OUTPUT([ common/Makefile common/mp4v2/Makefile libfaac/Makefile frontend/Makefile include/Makefile Makefile]) faac-1.28/docs/0000755010307701030770000000000011144236235014775 5ustar fabian-guestfabian-guestfaac-1.28/docs/faac.html0000644010307701030770000001623207760444062016571 0ustar fabian-guestfabian-guest FAAC - Freeware Advanced Audio Coder

FAAC 1.18 beta (www.audiocoding.com)


Contents

  • Usage
  • options
  • notes
  • Copyrights
  • Patents
  • People


  • Usage

    (More up to date info can be found at
    FAAC wiki page by Hans-Jürgen Bardenhagen)

    faac [options] <infile> <outfile>

    Options:
  • -a X Set average bitrate to approximately X kbps per channel (i.e. using -a 64 averages at 128 kbps/stereo).
  • -c <bandwidth> Set the bandwidth in Hz (default value depends on sample rate)
  • -q <quality> Set quantizer quality (default: 100, averages at approx. 128 kbps VBR for a normal stereo input file at 16 bit and 44.1 kHz sample rate).
  • --tns Enable TNS coding.
  • --notns Disable TNS coding.
  • -n Disable mid/side coding.
  • -m X AAC MPEG version, X can be 2 or 4 (default: MPEG-2, so for the sake of interoperability with non-standard compliant players like QuickTime 6 you should set it to "4").
  • -o X AAC object type, X can be LC, MAIN or LTP (default: LC, for the same reason as with the MPEG version don't use Main or LTP).
  • -r RAW AAC output file (i.e. without ADTS headers).
  • -P Raw PCM input mode.
  • -R Raw PCM input sample rate in Hz (default: 44100 Hz).
  • -B Raw PCM input bit depth (default: 16 bits, also possible 8 bits).
  • -C Raw PCM input channels (default: 2).
  • - <stdin> If you simply use a hyphen/minus sign instead of an input file name, FAAC can encode directly from stdin, thus enabling piping within other applications like foobar2000 or mp4live.

    Note: VBR output bitrate depends on -q AND -c, so you should only vary the default setting -q 100 -c 16000 if you know what you're doing and/or want to experiment with other cutoff frequencies at a given quality setting.

    The ABR setting with -a is an approximate average bitrate that does not use a bit reservoir, i.e -a 64 and -q 100 at 44.1 kHz will result in exactly the same output file.

    The following list should give some orientation for useful -q and -c settings, based on FAAC v1.17. The resulting VBR bitrates are referring to an average sounding stereo file with 16bit, 44.1 kHz, i.e. ct_reference.wav in this case. Multiplexing these AAC files to MP4 with e.g. mp4creator will result in a ~3 kbps lower bitrate because of the stripped ADTS headers:

    -q 130 -c 22000 -m 4 (~218 kbps)
    -q 120 -c 20000 -m 4 (~194 kbps)
    -q 110 -c 18000 -m 4 (~158 kbps)
    -q 100 -c 16000 -m 4 (~129 kbps)
    -q 90 -c 14000 -m 4 (~103 kbps)
    -q 80 -c 12000 -m 4 (~79 kbps)
    -q 70 -c 10000 -m 4 (~62 kbps)

    The added -m 4 switch does not change the bitrate or sound of course, but is recommended for most AAC/MP4 players that use an updated FAAD2-based plugin from this year (Winamp 2.x, foobar2000 etc.) or can't decode MPEG-2 AAC LC files like QuickTime 6. Philips Expanium users should not use this switch, because their CD portable does not know MPEG-4 AAC files.



    Copyrights

    FAAC - Freeware Advanced Audio Coder (
    www.audiocoding.com)
    	Portions Copyright © 1999,2000,2001 Menno Bakker
    	Portions Copyright © 2002,2003 Krzysztof Nikiel
    
    FAAC is based on the ISO MPEG-4 reference code. For this base code the following license applies:
    This software module was originally developed by
    
    FirstName LastName (CompanyName)
    
    and edited by
    
    FirstName LastName (CompanyName)
    FirstName LastName (CompanyName)
    
    in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard
    ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an
    implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools
    as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives
    users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this
    software module or modifications thereof for use in hardware or
    software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio
    standards. Those intending to use this software module in hardware or
    software products are advised that this use may infringe existing
    patents. The original developer of this software module and his/her
    company, the subsequent editors and their companies, and ISO/IEC have
    no liability for use of this software module or modifications thereof
    in an implementation. Copyright is not released for non MPEG-2
    NBC/MPEG-4 Audio conforming products. The original developer retains
    full right to use the code for his/her own purpose, assign or donate
    the code to a third party and to inhibit third party from using the
    code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This
    copyright notice must be included in all copies or derivative works.
    
    Copyright © 1997.
    

    For the changes made for the FAAC project the GNU Library General Public License (LGPL), version 2 1991 applies. For the changes the following statement applies:
    FAAC - Freeware Advanced Audio Coder
    Copyright © 1999,2000,2001,2002,2003 FAAC developers
    
    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
    

    Patents

    Please note that the use of this software may require the payment of patent royalties. You need to consider this issue before you start building derivative works. We are not warranting or indemnifying you in any way for patent royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!



    People

    Currently maintained by M. Bakker (menno)


    Other contributors:
    Tony Lenox
    RageOMatic
    thebard
    Ivan Dimkovic
    Krzysztof Nikiel (knik)
    Janne Hyvrinen (ca5e)
    Stuart Espey (stux)
    Andrew Voznytsa
    Mns Rullgrd
    Bill May


    Copyright © 2003 AudioCoding.com
    faac-1.28/docs/faac.10000644010307701030770000000500111136732046015747 0ustar fabian-guestfabian-guest.TH FAAC 1 "2007-10-11" "1.26" "Free Advanced Audio Coder" .SH NAME faac \- open source MPEG-4 and MPEG-2 AAC encoder .SH SYNOPSIS .B faac .RI [ options ] .RI [\-o\ outfile ] .I infiles .RI ... .PP .RI < infiles > and/or .RI < outfile > can be "\-", which means stdin/stdout. .SH DESCRIPTION .B FAAC is an open source MPEG-4 and MPEG-2 AAC encoder, it is licensed under the LGPL license. Note that the quality of .B FAAC is not up to par with the currently best AAC encoders available. .SH FEATURES .TP * Portable .TP * Reasonably fast .TP * LC, Main, LTP support .TP * DRM support through DreaM (optional) .SH OPTIONS .TP .BR \-q\ <\fIquality\fP> Set default variable bitrate (VBR) quantizer quality in percent (default: 100). .TP .BR \-b\ <\fIbitrate\fP> Set average bitrate (ABR, lower quality mode) to approximately \fIbitrate\fP kbps. .TP .BR \-c\ <\fIfreq\fP> Set the bandwidth in Hz (default: automatic). .TP .BR \-o\ \fIX\fP Set output file to \fIX\fP (only for one input file). .TP .BR \-r Use RAW AAC output file. .TP .BR \-P Raw PCM input mode (default: 44100Hz 16bit stereo). .TP .BR \-R Raw PCM input rate. .TP .BR \-B Raw PCM input sample size (8, 16 [default], 24 or 32bits). .TP .BR \-C Raw PCM input channels. .TP .BR \-X Raw PCM swap input bytes .TP .BR \-I\ <\fIC\fP,\fILF\fP> Input channel config (default: 3,4 [which means Center is third and LFE is fourth]). .SH MP4-SPECIFIC OPTIONS (if built with MP4V2) .TP .BR \-w Wrap AAC data in MP4 container (default for *.mp4 and *.m4a). .TP .BR \-s Optimize MP4 container layout after encoding. .TP .BR \-\-artist\ \fIX\fP Set artist to \fIX\fP .TP .BR \-\-writer\ \fIX\fP Set writer to \fIX\fP .TP .BR \-\-title\ \fIX\fP Set title to \fIX\fP .TP .BR \-\-genre\ \fIX\fP Set genre to \fIX\fP .TP .BR \-\-album\ \fIX\fP Set album to \fIX\fP .TP .BR \-\-compilation Set compilation .TP .BR \-\-track\ \fIX\fP Set track to \fIX\fP (number/total) .TP .BR \-\-disc\ \fIX\fP Set disc to \fIX\fP (number/total) .TP .BR \-\-year\ \fIX\fP Set year to \fIX\fP .TP .BR \-\-cover-art\ \fIX\fP Read cover art from file \fIX\fP .TP .BR \-\-comment\ \fIX\fP Set comment to \fIX\fP .SH DOCUMENTATION .TP .BR \-\-help for short help on using FAAC. .TP .BR \-\-long-help for a description of all options for FAAC. .TP .BR \-\-license for the license terms for FAAC. .SH AUTHORS .B FAAC was written by M. Bakker . .PP This manpage was written by Fabian Greffrath for the Debian Unofficial project (but may be used by others, of course).faac-1.28/docs/libfaac.html0000644010307701030770000001145107714434026017254 0ustar fabian-guestfabian-guest FAAC - ISO/MPEG 2/4 AAC Encoder Library

    FAAC - ISO/MPEG 2/4 AAC Encoder Library version 1.0
    (www.audiocoding.com)

    Contents

  • Scope
  • Interface description
  • Usage
  • Calling sequence
  • Function reference
  • Initialization / De-initialization
  • faacEncOpen()
  • faacEncClose()
  • Encoder configuration
  • faacEncGetCurrentConfiguration()
  • faacEncSetConfiguration()
  • Encoding functions
  • faacEncEncode()
  • Data structures reference
  • faacEncConfiguration
  • Scope

    This document describes the interface and usage of the FAAC - ISO/MPEG 2/4 AAC Encoder Library Developed for the Freeware Advanced Audio Coding project.

    Interface description

    The ISO/MPEG 2/4 AAC Encoder Library provides a high-level interface for encoding MPEG2 and MPEG4 ISO AAC files. The following header file is provided for usage in C/C++ programs:

    faac.h: function prototypes

    The encoder core resides in a statically linkable library called libfaac.lib (Microsoft Windows) or libfaac.a (UNIX). There are various example programs that show how to use the library.

    Usage

    Calling sequence

    For encoding AAC bitstreams the following calling sequence is mandatory:
  • Call faacEncOpen() for every encoder instance you need.
  • To set encoder options, call faacEncGetCurrentConfiguration(), change the parameters in the structure accessible by the returned pointer and then call faacEncSetConfiguration().
  • As long as there are still samples left to encode, call faacEncEncode() to encode the data. The encoder returns the bitstream data in a client-supplied buffer.
  • Once you call faacEncEncode() with zero samples of input the flushing process is initiated; afterwards you may call faacEncEncode() with zero samples input only.
    faacEncEncode() will continue to write out data until all audio samples have been encoded.
  • Once faacEncEncode() has returned with zero bytes written, call faacEncClose() to destroy this encoder instance.
  • Function reference

    Initialization / De-initialization

    faacEncOpen()
    Prototype
    faacEncHandle FAACAPI faacEncOpen
    (
    unsigned long sampleRate,
    unsigned int numChannels,
    unsigned long *inputSamples,
    unsigned long *maxOutputBytes
    );
    Description
    Open and initialize one instance of the encoder.
    Parameters
    
  • sampleRate The samplerate of the encoder input data.
  • numChannels The number of channels of the encoder input data.
  • inputSamples Receives the total number of samples that should be fed to faacEncEncode() in each call.
  • maxOutputBytes Receives the maximum number of bytes that can be in the output buffer after a call to faacEncEncode(). Return value An initialized encoder handle. If anything goes wrong NULL is returned.
  • faacEncClose()
    Prototype
    void FAACAPI faacEncClose
    (
    faacEncHandle hEncoder
    );
    Description
    Closes an encoder instance.
    Parameters
    
  • hEncoder An encoder handle returned by faacEncOpen().
  • Encoder configuration

    faacEncGetCurrentConfiguration()
    Prototype
    faacEncConfigurationPtr FAACAPI
    faacEncGetCurrentConfiguration
    (
    faacEncHandle hEncoder
    );
    Description
    Get a pointer to a structure describing the current encoder
    configuration. You may change this structure and feed it into
    faacEncSetConfiguration().
    
    faacEncSetConfiguration()
    Prototype
    int FAACAPI faacEncSetConfiguration
    (
    faacDecHandle hDecoder,
    faacEncConfigurationPtr config
    );
    Description
    Set a new encoder configuration. See
    faacEncGetCurrentConfiguration().
    


    Copyright © 2001,2003
    AudioCoding.com. All rights reserved.
    faac-1.28/docs/libfaac.pdf0000644010307701030770000006167107301306754017070 0ustar fabian-guestfabian-guest%PDF-1.2 % 12 0 obj << /Length 13 0 R /Filter /FlateDecode >> stream Hn0 te~;7M6`FznK 7$ˋӤ( lQG*1(%tkH%E6[nftկD VUx]AV!BOB1JB~IQ0ZLQkY(?H2XgYbwr ڂCP\eHtf\zVO{"T1mVHdmgg^F,0% endstream endobj 13 0 obj 461 endobj 4 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font << /F0 6 0 R /F1 8 0 R /F2 10 0 R >> /ProcSet 2 0 R >> /Contents 12 0 R >> endobj 17 0 obj << /Length 18 0 R /Filter /FlateDecode >> stream HWMo8<u"@] =UdC@NeEׯDiɎ6#J͛ym9Q V݄\lAT_&SOi5Z@#Z3ϝ[}څ A@EXejCX}  0_P_k}+Rf)F0._D_ˤrT6[PD) ,CS ~JVh6&i>;uՔĘF#L DBXe)vYH VTt"&Բ")ƥ6|lJ Q9ʡ\2$~l!ͣVr=r`mG7,Fic xC"y mDGQ#p 4PRQKmܰٸ zpECKҜTbtVN]nm6{ 3cKP\%imZ/|S8̀tҟ+U74̛Miv*fx&_Y " 'XS&bQK3s#н1,U,yk;"u,3.ޙLLzq:-6QB `%.EZO!Tf*7+_/ + ..%h+n_f[ c BwoJ8FjN#axixe. 1~ u'PTQ%ҽrX endstream endobj 18 0 obj 1044 endobj 14 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font << /F0 6 0 R /F1 8 0 R /F2 10 0 R /F3 15 0 R >> /ProcSet 2 0 R >> /Contents 17 0 R >> endobj 20 0 obj << /Length 21 0 R /Filter /FlateDecode >> stream Hn0 ŠHY}50`ؽk+.~sca'ʟLs&AK%@8 [8hVUD.8CWP?L2ae.ʰTeLBrNCǔ3B.abTKDJj÷VEB~chUov쌅m*J)Q + 7# _**&<0(;TrԌ.Iy2襘7I*R|.p!,a8*5ܶ㣉>;<ؘ|K< QʸЍNP.m"*3w{p2vߴ9>Eox!gNŧe`S?tՏ+FO<2!z.XO-^&?`l +sJzܺABG<_n&:؏6<7{jEfv|0EMvc[gH endstream endobj 21 0 obj 467 endobj 19 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font << /F0 6 0 R /F1 8 0 R /F2 10 0 R >> /ProcSet 2 0 R >> /Contents 20 0 R >> endobj 23 0 obj << /Length 24 0 R /Filter /FlateDecode >> stream HUn0;6Ls,E-Pw9ȔV I/7mӠ0zΛG]/$F@R/ܫbuA"(F$Wfo ,¯\O4IC :)A1EY%K(,baJIĺ>?")eLxquUe4ot _ $4 *,=,t0fMB^a=QْHDE@2+eӖXKI=-AD4%T3M3fM [-qGzI1%-՟HD"μ. K 4.XHDLeѓG()͓)c4d S^7`٢ڂk61 29UNw^E4 t""ǰuYbgAAm{w#cWQ3ƣ/j k endstream endobj 24 0 obj 747 endobj 22 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font << /F0 6 0 R /F1 8 0 R /F2 10 0 R >> /ProcSet 2 0 R >> /Contents 23 0 R >> endobj 30 0 obj << /Length 31 0 R /Filter /FlateDecode >> stream HWَ6'@!).R4uf-&@> -3*dr%n @` {=\B Ȁ`P0V+X?! `b 1Wa;k a/fg~ p[d imI~K ( !8zzxX[#ԥT߂z=6c]jo庑!r0'!CN%M)NJmFjIKd;ܩ̖d)J0ͦQh!7#%"5{"4))C9'4!Yd#(bzA>)O`FߴUU֯U.|[a HإGȈn57ڂˮ%w-Xߋ̭4j1aʧdn?<;m Zl+S0pqPεrE.y1!1+[igTI˂ y80}W˻ aE6t^-B"RBr}QUh̲n;iq=@'&)sO#b͈t+m +uݾw6j|24Qu˾iT-u-_`_bL̻F[mH60/\Ԙ8e'Bq#1A#أtMmrYʺW(M)MtFY/Mϭ"#4$`/q`[|a{q$gG\I2%MFL\pphCf;Q2cgeT>g΍s6<wXOiB$jYvĔ<`09'kqk0Mz jZ i' endstream endobj 31 0 obj 1219 endobj 25 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font 34 0 R /ProcSet 2 0 R >> /Contents 30 0 R >> endobj 34 0 obj << /F0 6 0 R /F1 8 0 R /F2 10 0 R /F4 26 0 R /F5 28 0 R /F6 32 0 R >> endobj 38 0 obj << /Length 39 0 R /Filter /FlateDecode >> stream HWNF~\1szrhhAi1ɄJl8l٧lNE+$?D_M 0?3@ )1_&0A\O 5S~OXϕMPS'D ̬1 &AuAusqqՈuia? N/?\ 9Fu(wSUo/@q쵝 P1s4j a3 Zd}j$9cSHPi(# EJUX( 9}RfXtSHB*Z%Ǒ r Zۜ!cSs[umo \y!O^RQOC "pcԥ9U4Nd(40fہJ̈́(پl{n ]Vs.=ٜ߯\.>ڎH8+OH1nj餔%3X㋍RDd='\d=Y:v]n]=Ȩk1ԥUC.޿2_0\T2H1jd2bk7M*bSuR?M0 1Ҹm!X5 [2sR?`,Z糵~5yczzs ݠYs-*񼸞Oѳ endstream endobj 39 0 obj 1428 endobj 35 0 obj << /Type /Page /Parent 5 0 R /Resources << /Font 42 0 R /ProcSet 2 0 R >> /Contents 38 0 R >> endobj 42 0 obj << /F0 6 0 R /F1 8 0 R /F2 10 0 R /F4 26 0 R /F5 28 0 R /F6 32 0 R /F7 36 0 R /F8 40 0 R >> endobj 45 0 obj << /Length 46 0 R /Filter /FlateDecode >> stream HWnFˊdMDHOvMiR8d"ŐC^Rph(ԓ蟙 .:M q m7&/ UQExvW[a#_N-䔞Yg׋q endstream endobj 46 0 obj 1246 endobj 43 0 obj << /Type /Page /Parent 44 0 R /Resources << /Font 47 0 R /ProcSet 2 0 R >> /Contents 45 0 R >> endobj 47 0 obj << /F0 6 0 R /F1 8 0 R /F4 26 0 R /F5 28 0 R /F6 32 0 R /F7 36 0 R >> endobj 49 0 obj << /Length 50 0 R /Filter /FlateDecode >> stream HUn8*^Nٸ\)Ze'6&܅vfߕ|%Кe3CȪ4 ,Qa_;ZΆOgQ;^G)l+ē-ϓ)/죋 ]MB=%VFqԖ!9YwIMkr( AL&vp4zee]C˛bcÔ%]wWbKc.7]YΆL?–i朖)~Af?> /ProcSet 2 0 R >> /Contents 49 0 R >> endobj 52 0 obj << /Length 53 0 R /Filter /FlateDecode >> stream HW[OFy1sODtWbTݗd 6l޹QՊ L||gsm~$`ƀ``/ 0?^A 2)1/VG0C\觅~ X_X~yDH0b!މ`$^y]Wgg^!&-ԫ|wswO)0/ET .yP:ıvzBK0$JN$%r{Il;w`%)XD;z1L(]]tFQ+ըj ceq(@$!$2,̇ZB2rUQ,7jUMѕuR8 3oBʪ\_1a0!y7:Y8''T+8!::w$c}b$S|&n"p-)>jmՖJ-AYuI?" PW$QnhYy;fS?(mDf,$a>m*9!Ww7B(X6ueGх;1|HX8U*ĕj\vJr+'j55O2d}><}AXWv1`M:԰FByZ#ES>O 렕"rA-/IM]?l_[x`QT`PTk*\j2&T.bdkeH@W,[紩"A>^Ҩsk\ŮIH&>*6b#zب-A$Wf_BεﵳK*yA5) FD0"r魯=$Ə1$CRcb1ݱl8Wo|Ҁٜ+Gƹx 3ҿ+SZjNքWjF~ug]2[E('8rFo>GpvZb !lQQd\oiG,s̾u"5\mCS &+AȞr̉\wJi pM2 ,3g$2vm[mP?ScН'ZJCSQ 5Θ|JFM"vb<).nv1|$Hrġd$ bkե**Bq5PmE,,=6U݁vT7L=Nk:si|v ͺWጞVO,50σ!9a^2G Q!]Tߙ1 V+tSEsoŻZϜhzUzk2-xU!#s9K[|<Úi]{8,[ y{,\P?`_j*Y=}sl"s9?,o$ endstream endobj 53 0 obj 1415 endobj 51 0 obj << /Type /Page /Parent 44 0 R /Resources << /Font 54 0 R /ProcSet 2 0 R >> /Contents 52 0 R >> endobj 54 0 obj << /F0 6 0 R /F1 8 0 R /F2 10 0 R /F4 26 0 R /F5 28 0 R /F6 32 0 R >> endobj 6 0 obj << /Type /Font /Subtype /TrueType /Name /F0 /BaseFont /Verdana,Italic /FirstChar 32 /LastChar 255 /Widths [ 352 394 459 818 636 1076 727 269 454 454 636 818 364 454 364 454 636 636 636 636 636 636 636 636 636 636 454 454 818 818 818 545 1000 683 686 698 766 632 575 775 751 421 455 693 557 843 748 787 603 787 695 684 616 732 683 990 685 615 685 454 454 454 818 636 636 601 623 521 623 596 352 622 633 274 344 587 274 973 633 607 623 623 427 521 394 633 591 818 592 591 525 635 454 635 818 1000 636 1000 269 636 459 818 636 636 636 1519 684 454 1070 1000 685 1000 1000 269 269 459 459 545 636 1000 636 977 521 454 980 1000 525 615 352 394 636 636 636 636 454 636 636 1000 545 645 818 454 1000 636 542 818 542 542 636 642 636 364 636 542 545 645 1000 1000 1000 545 683 683 683 683 683 683 989 698 632 632 632 632 421 421 421 421 766 748 787 787 787 787 787 818 787 732 732 732 732 615 605 620 601 601 601 601 601 601 955 521 596 596 596 596 274 274 274 274 612 633 607 607 607 607 607 818 607 633 633 633 633 591 623 591 ] /Encoding /WinAnsiEncoding /FontDescriptor 7 0 R >> endobj 7 0 obj << /Type /FontDescriptor /FontName /Verdana,Italic /Flags 96 /FontBBox [ -250 -210 1830 1005 ] /MissingWidth 456 /StemV 92 /StemH 92 /ItalicAngle -11 /CapHeight 1005 /XHeight 503 /Ascent 1005 /Descent -210 /Leading 215 /MaxWidth 1525 /AvgWidth 508 >> endobj 8 0 obj << /Type /Font /Subtype /TrueType /Name /F1 /BaseFont /Verdana /FirstChar 32 /LastChar 255 /Widths [ 352 394 459 818 636 1076 727 269 454 454 636 818 364 454 364 454 636 636 636 636 636 636 636 636 636 636 454 454 818 818 818 545 1000 684 686 698 771 632 575 775 751 421 455 693 557 843 748 787 603 787 695 684 616 732 684 989 685 615 685 454 454 454 818 636 636 601 623 521 623 596 352 623 633 274 344 592 274 973 633 607 623 623 427 521 394 633 592 818 592 592 525 635 454 635 818 1000 636 1000 269 636 459 818 636 636 636 1521 684 454 1070 1000 685 1000 1000 269 269 459 459 545 636 1000 636 977 521 454 981 1000 525 615 352 394 636 636 636 636 454 636 636 1000 545 645 818 454 1000 636 542 818 542 542 636 642 636 364 636 542 545 645 1000 1000 1000 545 684 684 684 684 684 684 984 698 632 632 632 632 421 421 421 421 775 748 787 787 787 787 787 818 787 732 732 732 732 615 605 620 601 601 601 601 601 601 955 521 596 596 596 596 274 274 274 274 612 633 607 607 607 607 607 818 607 633 633 633 633 592 623 592 ] /Encoding /WinAnsiEncoding /FontDescriptor 9 0 R >> endobj 9 0 obj << /Type /FontDescriptor /FontName /Verdana /Flags 32 /FontBBox [ -250 -210 1822 1005 ] /MissingWidth 453 /StemV 92 /StemH 92 /ItalicAngle 0 /CapHeight 1005 /XHeight 503 /Ascent 1005 /Descent -210 /Leading 215 /MaxWidth 1518 /AvgWidth 508 >> endobj 10 0 obj << /Type /Font /Subtype /TrueType /Name /F2 /BaseFont /Verdana,Bold /FirstChar 32 /LastChar 255 /Widths [ 342 402 587 867 711 1272 862 332 543 543 711 867 361 480 361 689 711 711 711 711 711 711 711 711 711 711 402 402 867 867 867 617 964 776 762 724 830 683 650 811 837 546 555 771 637 948 847 850 733 850 782 710 682 812 764 1128 764 737 692 543 689 543 867 711 711 668 699 588 699 664 422 699 712 342 403 671 342 1058 712 687 699 699 497 593 456 712 650 979 669 651 597 711 543 711 867 1000 711 1000 332 711 587 1049 711 711 711 1777 710 543 1135 1000 692 1000 1000 332 332 587 587 711 711 1000 711 964 593 543 1068 1000 597 737 342 402 711 711 711 711 543 711 711 964 598 850 867 480 964 711 587 867 598 598 711 721 711 361 711 598 598 850 1182 1182 1182 617 776 776 776 776 776 776 1094 724 683 683 683 683 546 546 546 546 830 847 850 850 850 850 850 867 850 812 812 812 812 737 735 713 668 668 668 668 668 668 1018 588 664 664 664 664 342 342 342 342 679 712 687 687 687 687 687 867 687 712 712 712 712 651 699 651 ] /Encoding /WinAnsiEncoding /FontDescriptor 11 0 R >> endobj 11 0 obj << /Type /FontDescriptor /FontName /Verdana,Bold /Flags 16416 /FontBBox [ -250 -210 2129 1005 ] /MissingWidth 542 /StemV 181 /StemH 181 /ItalicAngle 0 /CapHeight 1005 /XHeight 503 /Ascent 1005 /Descent -210 /Leading 215 /MaxWidth 1774 /AvgWidth 568 >> endobj 15 0 obj << /Type /Font /Subtype /TrueType /Name /F3 /BaseFont /TimesNewRoman /FirstChar 32 /LastChar 255 /Widths [ 250 333 408 500 500 833 778 180 333 333 500 564 250 333 250 278 500 500 500 500 500 500 500 500 500 500 278 278 564 564 564 444 921 722 667 667 722 611 556 722 722 333 389 722 611 889 722 722 556 722 667 556 611 722 722 944 722 722 611 333 278 333 469 500 333 444 500 444 500 444 333 500 500 278 278 500 278 778 500 500 500 500 333 389 278 500 500 722 500 500 444 480 200 480 541 778 500 778 333 500 444 1000 500 500 333 1000 556 333 889 778 611 778 778 333 333 444 444 350 500 1000 333 980 389 333 722 778 444 722 250 333 500 500 500 500 200 500 333 760 276 500 564 333 760 500 400 549 300 300 333 576 453 250 333 300 310 500 750 750 750 444 722 722 722 722 722 722 889 667 611 611 611 611 333 333 333 333 722 722 722 722 722 722 722 564 722 722 722 722 722 722 556 500 444 444 444 444 444 444 667 444 444 444 444 444 278 278 278 278 500 500 500 500 500 500 500 549 500 500 500 500 500 500 500 500 ] /Encoding /WinAnsiEncoding /FontDescriptor 16 0 R >> endobj 16 0 obj << /Type /FontDescriptor /FontName /TimesNewRoman /Flags 34 /FontBBox [ -250 -216 1166 1000 ] /MissingWidth 324 /StemV 73 /StemH 73 /ItalicAngle 0 /CapHeight 891 /XHeight 446 /Ascent 891 /Descent -216 /Leading 149 /MaxWidth 972 /AvgWidth 401 >> endobj 26 0 obj << /Type /Font /Subtype /TrueType /Name /F4 /BaseFont /Arial,BoldItalic /FirstChar 32 /LastChar 255 /Widths [ 278 333 474 556 556 889 722 238 333 333 389 584 278 333 278 278 556 556 556 556 556 556 556 556 556 556 333 333 584 584 584 611 975 722 722 722 722 667 611 778 722 278 556 722 611 833 722 778 667 778 722 667 611 722 667 944 667 667 611 333 278 333 584 556 333 556 611 556 611 556 333 611 611 278 278 556 278 889 611 611 611 611 389 556 333 611 556 778 556 556 500 389 280 389 584 750 556 750 278 556 500 1000 556 556 333 1000 667 333 1000 750 611 750 750 278 278 500 500 350 556 1000 333 1000 556 333 944 750 500 667 278 333 556 556 556 556 280 556 333 737 370 556 584 333 737 552 400 549 333 333 333 576 556 278 333 333 365 556 834 834 834 611 722 722 722 722 722 722 1000 722 667 667 667 667 278 278 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667 667 611 556 556 556 556 556 556 889 556 556 556 556 556 278 278 278 278 611 611 611 611 611 611 611 549 611 611 611 611 611 556 611 556 ] /Encoding /WinAnsiEncoding /FontDescriptor 27 0 R >> endobj 27 0 obj << /Type /FontDescriptor /FontName /Arial,BoldItalic /Flags 16480 /FontBBox [ -250 -212 1174 1000 ] /MissingWidth 326 /StemV 153 /StemH 153 /ItalicAngle -11 /CapHeight 905 /XHeight 453 /Ascent 905 /Descent -212 /Leading 150 /MaxWidth 978 /AvgWidth 479 >> endobj 28 0 obj << /Type /Font /Subtype /TrueType /Name /F5 /BaseFont /Symbol /FirstChar 30 /LastChar 255 /Widths [ 600 600 250 333 713 500 549 833 778 439 333 333 500 549 250 549 250 278 500 500 500 500 500 500 500 500 500 500 278 278 549 549 549 444 549 722 667 722 612 611 763 603 722 333 631 722 686 889 722 722 768 741 556 592 611 690 439 768 645 795 611 333 863 333 658 500 500 631 549 549 494 439 521 411 603 329 603 549 549 576 521 549 549 521 549 603 439 576 713 686 493 686 494 480 200 480 549 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 620 247 549 167 713 500 753 753 753 753 1042 987 603 987 603 400 549 411 549 549 713 494 460 549 549 549 549 1000 603 1000 658 823 686 795 987 768 768 823 768 768 713 713 713 713 713 713 713 768 713 790 790 890 823 549 250 713 603 603 1042 987 603 987 603 494 329 790 790 786 713 384 384 384 384 384 384 494 494 494 494 600 329 274 686 686 686 384 384 384 384 384 384 494 494 494 600 ] /FontDescriptor 29 0 R >> endobj 29 0 obj << /Type /FontDescriptor /FontName /Symbol /Flags 6 /FontBBox [ -250 -220 1249 1005 ] /MissingWidth 333 /StemV 109 /StemH 109 /ItalicAngle 0 /CapHeight 1005 /XHeight 503 /Ascent 1005 /Descent -220 /Leading 225 /MaxWidth 1041 /AvgWidth 600 >> endobj 32 0 obj << /Type /Font /Subtype /TrueType /Name /F6 /BaseFont /CourierNew,Bold /FirstChar 32 /LastChar 255 /Widths [ 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 ] /Encoding /WinAnsiEncoding /FontDescriptor 33 0 R >> endobj 33 0 obj << /Type /FontDescriptor /FontName /CourierNew,Bold /Flags 16418 /FontBBox [ -250 -300 716 1000 ] /MissingWidth 597 /StemV 191 /StemH 191 /ItalicAngle 0 /CapHeight 833 /XHeight 417 /Ascent 833 /Descent -300 /Leading 133 /MaxWidth 597 /AvgWidth 600 >> endobj 36 0 obj << /Type /Font /Subtype /TrueType /Name /F7 /BaseFont /Arial,Bold /FirstChar 32 /LastChar 255 /Widths [ 278 333 474 556 556 889 722 238 333 333 389 584 278 333 278 278 556 556 556 556 556 556 556 556 556 556 333 333 584 584 584 611 975 722 722 722 722 667 611 778 722 278 556 722 611 833 722 778 667 778 722 667 611 722 667 944 667 667 611 333 278 333 584 556 333 556 611 556 611 556 333 611 611 278 278 556 278 889 611 611 611 611 389 556 333 611 556 778 556 556 500 389 280 389 584 750 556 750 278 556 500 1000 556 556 333 1000 667 333 1000 750 611 750 750 278 278 500 500 350 556 1000 333 1000 556 333 944 750 500 667 278 333 556 556 556 556 280 556 333 737 370 556 584 333 737 552 400 549 333 333 333 576 556 278 333 333 365 556 834 834 834 611 722 722 722 722 722 722 1000 722 667 667 667 667 278 278 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667 667 611 556 556 556 556 556 556 889 556 556 556 556 556 278 278 278 278 611 611 611 611 611 611 611 549 611 611 611 611 611 556 611 556 ] /Encoding /WinAnsiEncoding /FontDescriptor 37 0 R >> endobj 37 0 obj << /Type /FontDescriptor /FontName /Arial,Bold /Flags 16416 /FontBBox [ -250 -212 1165 1000 ] /MissingWidth 323 /StemV 153 /StemH 153 /ItalicAngle 0 /CapHeight 905 /XHeight 453 /Ascent 905 /Descent -212 /Leading 150 /MaxWidth 971 /AvgWidth 479 >> endobj 40 0 obj << /Type /Font /Subtype /TrueType /Name /F8 /BaseFont /TrebuchetMS /FirstChar 32 /LastChar 255 /Widths [ 301 367 325 524 524 600 706 160 367 367 367 524 367 367 367 524 524 524 524 524 524 524 524 524 524 524 367 367 524 524 524 367 771 590 566 598 613 536 525 676 654 278 477 576 506 709 638 674 558 676 582 481 581 648 587 852 557 570 550 367 355 367 524 524 524 525 557 495 557 545 370 502 546 285 367 504 295 830 546 537 557 557 389 405 396 546 490 744 501 493 475 367 524 367 524 500 524 500 367 388 524 734 459 459 524 913 481 367 993 500 550 500 500 367 367 524 524 524 367 734 524 635 405 367 924 500 475 570 301 367 524 524 524 570 524 454 524 713 367 524 524 367 713 524 524 524 451 454 524 546 524 367 524 451 367 524 814 814 814 367 590 590 590 590 590 590 867 598 536 536 536 536 278 278 278 278 613 638 674 674 674 674 674 524 657 648 648 648 648 570 556 546 525 525 525 525 525 525 873 495 545 545 545 545 285 285 285 285 549 546 537 537 537 537 537 524 545 546 546 546 546 493 553 493 ] /Encoding /WinAnsiEncoding /FontDescriptor 41 0 R >> endobj 41 0 obj << /Type /FontDescriptor /FontName /TrebuchetMS /Flags 32 /FontBBox [ -250 -222 1104 1000 ] /MissingWidth 340 /StemV 83 /StemH 83 /ItalicAngle 0 /CapHeight 939 /XHeight 470 /Ascent 939 /Descent -222 /Leading 161 /MaxWidth 920 /AvgWidth 454 >> endobj 2 0 obj [ /PDF /Text ] endobj 5 0 obj << /Kids [4 0 R 14 0 R 19 0 R 22 0 R 25 0 R 35 0 R ] /Count 6 /Type /Pages /Parent 55 0 R >> endobj 44 0 obj << /Kids [43 0 R 48 0 R 51 0 R ] /Count 3 /Type /Pages /Parent 55 0 R >> endobj 55 0 obj << /Kids [5 0 R 44 0 R ] /Count 9 /Type /Pages /MediaBox [ 0 0 596 842 ] >> endobj 1 0 obj << /Creator /CreationDate (D:20010518230136) /Title /Author /Producer (Acrobat PDFWriter 5.0 for Windows NT) >> endobj 3 0 obj << /Pages 55 0 R /Type /Catalog >> endobj xref 0 56 0000000000 65535 f 0000023881 00000 n 0000023561 00000 n 0000024205 00000 n 0000000578 00000 n 0000023592 00000 n 0000011365 00000 n 0000012468 00000 n 0000012734 00000 n 0000013830 00000 n 0000014087 00000 n 0000015193 00000 n 0000000019 00000 n 0000000558 00000 n 0000001863 00000 n 0000015461 00000 n 0000016552 00000 n 0000000720 00000 n 0000001842 00000 n 0000002583 00000 n 0000002018 00000 n 0000002563 00000 n 0000003571 00000 n 0000002726 00000 n 0000003551 00000 n 0000005032 00000 n 0000016813 00000 n 0000017910 00000 n 0000018181 00000 n 0000019247 00000 n 0000003714 00000 n 0000005011 00000 n 0000019505 00000 n 0000020595 00000 n 0000005142 00000 n 0000006755 00000 n 0000020862 00000 n 0000021953 00000 n 0000005228 00000 n 0000006734 00000 n 0000022216 00000 n 0000023302 00000 n 0000006865 00000 n 0000008318 00000 n 0000023700 00000 n 0000006973 00000 n 0000008297 00000 n 0000008429 00000 n 0000009498 00000 n 0000008515 00000 n 0000009478 00000 n 0000011168 00000 n 0000009654 00000 n 0000011147 00000 n 0000011279 00000 n 0000023789 00000 n trailer << /Size 56 /Root 3 0 R /Info 1 0 R /ID [<41022e51d44c0d7cc8d6eac38733ab06><41022e51d44c0d7cc8d6eac38733ab06>] >> startxref 24255 %%EOF faac-1.28/frontend/0000755010307701030770000000000011144236254015665 5ustar fabian-guestfabian-guestfaac-1.28/frontend/Makefile.in0000644010307701030770000003770711144236254017750 0ustar fabian-guestfabian-guest# 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 = faac$(EXEEXT) subdir = frontend DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_faac_OBJECTS = main.$(OBJEXT) input.$(OBJEXT) faac_OBJECTS = $(am_faac_OBJECTS) faac_LDADD = $(LDADD) @WITH_MP4V2_FALSE@faac_DEPENDENCIES = \ @WITH_MP4V2_FALSE@ $(top_builddir)/libfaac/libfaac.la @WITH_MP4V2_TRUE@faac_DEPENDENCIES = \ @WITH_MP4V2_TRUE@ $(top_builddir)/libfaac/libfaac.la \ @WITH_MP4V2_TRUE@ $(top_srcdir)/common/mp4v2/libmp4v2.a DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) 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 = $(faac_SOURCES) DIST_SOURCES = $(faac_SOURCES) man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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@ man_MANS = ../docs/faac.1 faac_SOURCES = main.c input.c @WITH_MP4V2_FALSE@INCLUDES = -I$(top_srcdir)/include @WITH_MP4V2_TRUE@INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/common/mp4v2 @WITH_MP4V2_FALSE@LDADD = $(top_builddir)/libfaac/libfaac.la -lm @WITH_MP4V2_TRUE@LDADD = $(top_builddir)/libfaac/libfaac.la $(top_srcdir)/common/mp4v2/libmp4v2.a -lm -lstdc++ 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) --gnu frontend/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu frontend/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 faac$(EXEEXT): $(faac_OBJECTS) $(faac_DEPENDENCIES) @rm -f faac$(EXEEXT) $(LINK) $(faac_LDFLAGS) $(faac_OBJECTS) $(faac_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.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: 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 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-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 \ mostlyclean-libtool 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 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-man1 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 \ 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: faac-1.28/frontend/Makefile.am0000644010307701030770000000053011121576240017714 0ustar fabian-guestfabian-guestbin_PROGRAMS = faac man_MANS = ../docs/faac.1 faac_SOURCES = main.c input.c if WITH_MP4V2 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/common/mp4v2 LDADD = $(top_builddir)/libfaac/libfaac.la $(top_srcdir)/common/mp4v2/libmp4v2.a -lm -lstdc++ else INCLUDES = -I$(top_srcdir)/include LDADD = $(top_builddir)/libfaac/libfaac.la -lm endif faac-1.28/frontend/faac.sln0000644010307701030770000000373511136456617017315 0ustar fabian-guestfabian-guest Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faac", "faac.vcproj", "{92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}" ProjectSection(ProjectDependencies) = postProject {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B} = {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B} {9CC48C6E-92EB-4814-AD37-97AB3622AB65} = {9CC48C6E-92EB-4814-AD37-97AB3622AB65} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac", "..\libfaac\libfaac.vcproj", "{9CC48C6E-92EB-4814-AD37-97AB3622AB65}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2_st", "..\common\mp4v2\libmp4v2_st60.vcproj", "{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}.Debug|Win32.ActiveCfg = Debug|Win32 {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}.Debug|Win32.Build.0 = Debug|Win32 {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}.Release|Win32.ActiveCfg = Release|Win32 {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}.Release|Win32.Build.0 = Release|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Debug|Win32.ActiveCfg = Debug|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Debug|Win32.Build.0 = Debug|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Release|Win32.ActiveCfg = Release|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Release|Win32.Build.0 = Release|Win32 {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Debug|Win32.ActiveCfg = Debug|Win32 {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Debug|Win32.Build.0 = Debug|Win32 {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Release|Win32.ActiveCfg = Release|Win32 {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/frontend/faac.vcproj0000644010307701030770000001136511112620744020006 0ustar fabian-guestfabian-guest faac-1.28/frontend/faacgui.rc0000644010307701030770000001101207640630216017607 0ustar fabian-guestfabian-guest//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_MAINDIALOG DIALOGEX 0, 0, 264, 190 STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "FAAC GUI" FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "...",IDC_SELECT_INPUTFILE,225,12,19,14,0, WS_EX_STATICEDGE PUSHBUTTON "...",IDC_SELECT_OUTPUTFILE,225,33,19,14,WS_DISABLED, WS_EX_STATICEDGE CONTROL "Allow Mid/Side",IDC_ALLOWMIDSIDE,"Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,14,81,71,10 LTEXT "Quantizer\nquality", IDC_STATIC, 98, 73, 44, 18 EDITTEXT IDC_QUALITY, 138, 76, 30, 12, ES_AUTOHSCROLL CONTROL "", IDC_STATIC, "static", SS_SUNKEN, 98, 94, 70, 30 CONTROL "Set bandwidth", IDC_BWCTL, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 102, 96, 62, 12 EDITTEXT IDC_BANDWIDTH,102,109,34,12,ES_AUTOHSCROLL | WS_DISABLED | WS_TABSTOP LTEXT "Hz", IDC_STATIC, 140, 111, 10, 8 DEFPUSHBUTTON "Encode",IDOK,200,152,50,14,WS_DISABLED PUSHBUTTON "Quit",IDCANCEL,200,170,50,14 LTEXT "",IDC_TIME,7,151,190,20 LTEXT "", IDC_COMPILEDATE, 20, 176, 150, 8 EDITTEXT IDC_INPUTFILENAME,61,12,158,14,ES_AUTOHSCROLL EDITTEXT IDC_OUTPUTFILENAME,61,33,158,14,ES_AUTOHSCROLL | WS_DISABLED LTEXT "Input File:",IDC_STATIC,18,13,38,8 LTEXT "Output File:",IDC_STATIC,18,34,37,8 CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,7,54, 250,1 LTEXT "-",IDC_INPUTPARAMS,32,66,55,8 LTEXT "In:",IDC_STATIC,14,66,12,8 CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7, 135,250,10 GROUPBOX "Output Format",IDC_STATIC,93,62,164,67 CONTROL "Use RAW output",IDC_USERAW,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,14,103,71,10 CONTROL "Use TNS",IDC_USETNS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,14,92,71,10 COMBOBOX IDC_MPEGVERSION,183,82,67,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_OBJECTTYPE,183,109,67,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "MPEG Verion",IDC_STATIC,183,73,44,8 LTEXT "AAC Object Type",IDC_STATIC,183,100,56,8 CONTROL "Use LFE channel",IDC_USELFE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP,14,114,71,10 END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN IDD_MAINDIALOG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 257 TOPMARGIN, 7 BOTTOMMARGIN, 178 END END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Dialog Info // IDD_MAINDIALOG DLGINIT BEGIN IDC_MPEGVERSION, 0x403, 1, 0 "\000" 0 END #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED faac-1.28/frontend/faacgui.sln0000644010307701030770000000244110663100426017777 0ustar fabian-guestfabian-guestMicrosoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faacgui", "faacgui.vcproj", "{B4FD0E50-5379-48C3-8D3E-D948A8921CA8}" ProjectSection(ProjectDependencies) = postProject {9CC48C6E-92EB-4814-AD37-97AB3622AB65} = {9CC48C6E-92EB-4814-AD37-97AB3622AB65} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac", "..\libfaac\libfaac.vcproj", "{9CC48C6E-92EB-4814-AD37-97AB3622AB65}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B4FD0E50-5379-48C3-8D3E-D948A8921CA8}.Debug|Win32.ActiveCfg = Debug|Win32 {B4FD0E50-5379-48C3-8D3E-D948A8921CA8}.Debug|Win32.Build.0 = Debug|Win32 {B4FD0E50-5379-48C3-8D3E-D948A8921CA8}.Release|Win32.ActiveCfg = Release|Win32 {B4FD0E50-5379-48C3-8D3E-D948A8921CA8}.Release|Win32.Build.0 = Release|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Debug|Win32.ActiveCfg = Debug|Win32 {9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Release|Win32.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/frontend/faacgui.vcproj0000644010307701030770000001274210663100426020513 0ustar fabian-guestfabian-guest faac-1.28/frontend/getopt.c0000644010307701030770000005423410037726026017344 0ustar fabian-guestfabian-guest/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef __STDC__ # ifndef const # define const # endif #endif /* This tells Alpha OSF/1 not to define a getopt prototype in . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #include //#include "tailor.h" /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) || !__MacOSX__ /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #endif /* GNU C library. */ /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a long-named option. Because this is not POSIX.2 compliant, it is being phased out. */ /* #define GETOPT_COMPAT */ /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = 0; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ #define BAD_OPTION '\0' int optopt = BAD_OPTION; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; #if defined(__GNU_LIBRARY__) || defined(__APPLE__) /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #define my_strlen strlen #else /* Avoid depending on library functions or files whose names are inconsistent. */ #if __STDC__ || defined(PROTO) extern char *getenv(const char *name); extern int strcmp (const char *s1, const char *s2); extern int strncmp(const char *s1, const char *s2, unsigned int n); static int my_strlen(const char *s); static char *my_index (const char *str, int chr); #else extern char *getenv (); #endif static int my_strlen (str) const char *str; { int n = 0; while (*str++) n++; return n; } static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } #endif /* GNU C library. */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. To perform the swap, we first reverse the order of all elements. So all options now come before all non options, but they are in the wrong order. So we put back the options and non options in original order by reversing them again. For example: original input: a b c -x -y reverse all: -y -x c b a reverse options: -x -y c b a reverse non options: -x -y a b c */ #if __STDC__ || defined(PROTO) static void exchange (char **argv); #endif static void exchange (argv) char **argv; { char *temp, **first, **last; /* Reverse all the elements [first_nonopt, optind) */ first = &argv[first_nonopt]; last = &argv[optind-1]; while (first < last) { temp = *first; *first = *last; *last = temp; first++; last--; } /* Put back the options in order */ first = &argv[first_nonopt]; first_nonopt += (optind - last_nonopt); last = &argv[first_nonopt - 1]; while (first < last) { temp = *first; *first = *last; *last = temp; first++; last--; } /* Put back the non options in order */ first = &argv[first_nonopt]; last_nonopt = optind; last = &argv[last_nonopt-1]; while (first < last) { temp = *first; *first = *last; *last = temp; first++; last--; } } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return BAD_OPTION after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return BAD_OPTION. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int option_index; optarg = 0; /* Initialize the internal data when the first call is made. Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ if (optind == 0) { first_nonopt = last_nonopt = optind = 1; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; } if (nextchar == NULL || *nextchar == '\0') { if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Now skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0') #ifdef GETOPT_COMPAT && (longopts == NULL || argv[optind][0] != '+' || argv[optind][1] == '\0') #endif /* GETOPT_COMPAT */ ) optind++; last_nonopt = optind; } /* Special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if ((argv[optind][0] != '-' || argv[optind][1] == '\0') #ifdef GETOPT_COMPAT && (longopts == NULL || argv[optind][0] != '+' || argv[optind][1] == '\0') #endif /* GETOPT_COMPAT */ ) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Start decoding its characters. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } if (longopts != NULL && ((argv[optind][0] == '-' && (argv[optind][1] == '-' || long_only)) #ifdef GETOPT_COMPAT || argv[optind][0] == '+' #endif /* GETOPT_COMPAT */ )) { const struct option *p; char *s = nextchar; int exact = 0; int ambig = 0; const struct option *pfound = NULL; int indfound = 0; while (*s && *s != '=') s++; /* Test all options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, s - nextchar)) { if (s - nextchar == my_strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += my_strlen (nextchar); optind++; return BAD_OPTION; } if (pfound != NULL) { option_index = indfound; optind++; if (*s) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = s + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } nextchar += my_strlen (nextchar); return BAD_OPTION; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += my_strlen (nextchar); return optstring[0] == ':' ? ':' : BAD_OPTION; } } nextchar += my_strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' #ifdef GETOPT_COMPAT || argv[optind][0] == '+' #endif /* GETOPT_COMPAT */ || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); else /* +option or -option */ fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; return BAD_OPTION; } } /* Look at and handle the next option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { #if 0 if (c < 040 || c >= 0177) fprintf (stderr, "%s: unrecognized option, character code 0%o\n", argv[0], c); else fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); #else /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); #endif } optopt = c; return BAD_OPTION; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = 0; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { #if 0 fprintf (stderr, "%s: option `-%c' requires an argument\n", argv[0], c); #else /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = BAD_OPTION; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case BAD_OPTION: break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ faac-1.28/frontend/getopt.h0000644010307701030770000001066007567736623017366 0ustar fabian-guestfabian-guest/* Declarations for getopt. Copyright (C) 1989, 1990, 1991, 1992, 1993 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif #ifndef __MacOSX__ /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #endif /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 //#if __STDC__ || defined(PROTO) #if defined(__GNU_LIBRARY__) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #endif /* not __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); //#else /* not __STDC__ */ extern int getopt (int argc, char *const *argv, const char *shortopts); //extern int getopt_long (); //extern int getopt_long_only (); //extern int _getopt_internal (); //#endif /* not __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ faac-1.28/frontend/input.c0000644010307701030770000002435111137132170017167 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2002 Krzysztof Nikiel * * 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 * * $Id: input.c,v 1.16 2009/01/25 18:50:32 menno Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifdef _WIN32 #include #include #endif #include "input.h" #define SWAP32(x) (((x & 0xff) << 24) | ((x & 0xff00) << 8) \ | ((x & 0xff0000) >> 8) | ((x & 0xff000000) >> 24)) #define SWAP16(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8)) #ifdef WORDS_BIGENDIAN # define UINT32(x) SWAP32(x) # define UINT16(x) SWAP16(x) #else # define UINT32(x) (x) # define UINT16(x) (x) #endif typedef struct { u_int32_t label; /* 'RIFF' */ u_int32_t length; /* Length of rest of file */ u_int32_t chunk_type; /* 'WAVE' */ } riff_t; typedef struct { u_int32_t label; u_int32_t len; } riffsub_t; #ifdef _MSC_VER #pragma pack(push, 1) #endif #define WAVE_FORMAT_PCM 1 #define WAVE_FORMAT_FLOAT 3 #define WAVE_FORMAT_EXTENSIBLE 0xfffe struct WAVEFORMATEX { u_int16_t wFormatTag; u_int16_t nChannels; u_int32_t nSamplesPerSec; u_int32_t nAvgBytesPerSec; u_int16_t nBlockAlign; u_int16_t wBitsPerSample; u_int16_t cbSize; } #ifdef __GNUC __attribute__((packed)) #endif ; struct WAVEFORMATEXTENSIBLE { struct WAVEFORMATEX Format; union { u_int16_t wValidBitsPerSample; // bits of precision u_int16_t wSamplesPerBlock; // valid if wBitsPerSample==0 u_int16_t wReserved; // If neither applies, set to zero. } Samples; u_int32_t dwChannelMask; // which channels are present in stream unsigned char SubFormat[16]; // guid } #ifdef __GNUC __attribute__((packed)) #endif ; #ifdef _MSC_VER #pragma pack(pop) #endif static unsigned char waveformat_pcm_guid[16] = { WAVE_FORMAT_PCM,0,0,0, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }; static void unsuperr(const char *name) { fprintf(stderr, "%s: file format not supported\n", name); } pcmfile_t *wav_open_read(const char *name, int rawinput) { int i; int skip; FILE *wave_f; riff_t riff; riffsub_t riffsub; struct WAVEFORMATEXTENSIBLE wave; char *riffl = "RIFF"; char *wavel = "WAVE"; char *bextl = "BEXT"; char *fmtl = "fmt "; char *datal = "data"; int fmtsize; pcmfile_t *sndf; int dostdin = 0; if (!strcmp(name, "-")) { #ifdef _WIN32 _setmode(_fileno(stdin), O_BINARY); #endif wave_f = stdin; dostdin = 1; } else if (!(wave_f = fopen(name, "rb"))) { perror(name); return NULL; } if (!rawinput) // header input { if (fread(&riff, 1, sizeof(riff), wave_f) != sizeof(riff)) return NULL; if (memcmp(&(riff.label), riffl, 4)) return NULL; if (memcmp(&(riff.chunk_type), wavel, 4)) return NULL; // handle broadcast extensions. added by pro-tools,otherwise it must be fmt chunk. if (fread(&riffsub, 1, sizeof(riffsub), wave_f) != sizeof(riffsub)) return NULL; riffsub.len = UINT32(riffsub.len); if (!memcmp(&(riffsub.label), bextl, 4)) { fseek(wave_f, riffsub.len, SEEK_CUR); if (fread(&riffsub, 1, sizeof(riffsub), wave_f) != sizeof(riffsub)) return NULL; riffsub.len = UINT32(riffsub.len); } if (memcmp(&(riffsub.label), fmtl, 4)) return NULL; memset(&wave, 0, sizeof(wave)); fmtsize = (riffsub.len < sizeof(wave)) ? riffsub.len : sizeof(wave); if (fread(&wave, 1, fmtsize, wave_f) != fmtsize) return NULL; for (skip = riffsub.len - fmtsize; skip > 0; skip--) fgetc(wave_f); for (i = 0;; i++) { if (fread(&riffsub, 1, sizeof(riffsub), wave_f) != sizeof(riffsub)) return NULL; riffsub.len = UINT32(riffsub.len); if (!memcmp(&(riffsub.label), datal, 4)) break; if (i > 10) return NULL; for (skip = riffsub.len; skip > 0; skip--) fgetc(wave_f); } if (UINT16(wave.Format.wFormatTag) != WAVE_FORMAT_PCM && UINT16(wave.Format.wFormatTag) != WAVE_FORMAT_FLOAT) { if (UINT16(wave.Format.wFormatTag) == WAVE_FORMAT_EXTENSIBLE) { if (UINT16(wave.Format.cbSize) < 22) // struct too small return NULL; if (memcmp(wave.SubFormat, waveformat_pcm_guid, 16)) { waveformat_pcm_guid[0] = WAVE_FORMAT_FLOAT; if (memcmp(wave.SubFormat, waveformat_pcm_guid, 16)) { unsuperr(name); return NULL; } } } else { unsuperr(name); return NULL; } } } sndf = malloc(sizeof(*sndf)); memset(sndf, 0, sizeof(*sndf)); sndf->f = wave_f; if (UINT16(wave.Format.wFormatTag) == WAVE_FORMAT_FLOAT) { sndf->isfloat = 1; } else { sndf->isfloat = (wave.SubFormat[0] == WAVE_FORMAT_FLOAT); } if (rawinput) { sndf->bigendian = 1; if (dostdin) sndf->samples = 0; else { fseek(sndf->f, 0 , SEEK_END); sndf->samples = ftell(sndf->f); rewind(sndf->f); } } else { sndf->bigendian = 0; sndf->channels = UINT16(wave.Format.nChannels); sndf->samplebytes = UINT16(wave.Format.wBitsPerSample) / 8; sndf->samplerate = UINT32(wave.Format.nSamplesPerSec); sndf->samples = riffsub.len / (sndf->samplebytes * sndf->channels); } return sndf; } static void chan_remap(int32_t *buf, int channels, int blocks, int *map) { int i; int32_t *tmp = malloc(channels * sizeof(int32_t)); for (i = 0; i < blocks; i++) { int chn; memcpy(tmp, buf + i * channels, sizeof(int32_t) * channels); for (chn = 0; chn < channels; chn++) buf[i * channels + chn] = tmp[map[chn]]; } } size_t wav_read_float32(pcmfile_t *sndf, float *buf, size_t num, int *map) { size_t i = 0; unsigned char bufi[8]; if ((sndf->samplebytes > 8) || (sndf->samplebytes < 1)) return 0; while (isamplebytes, 1, sndf->f) != 1) break; if (sndf->isfloat) { switch (sndf->samplebytes) { case 4: buf[i] = (*(float *)&bufi) * (float)32768; break; case 8: buf[i] = (float)((*(double *)&bufi) * (float)32768); break; default: return 0; } } else { // convert to 32 bit float // fix endianness switch (sndf->samplebytes) { case 1: /* this is endian clean */ buf[i] = ((float)bufi[0] - 128) * (float)256; break; case 2: #ifdef WORDS_BIGENDIAN if (!sndf->bigendian) #else if (sndf->bigendian) #endif { // swap bytes int16_t s = ((int16_t *)bufi)[0]; s = SWAP16(s); buf[i] = (float)s; } else { // no swap int s = ((int16_t *)bufi)[0]; buf[i] = (float)s; } break; case 3: if (!sndf->bigendian) { int s = bufi[0] | (bufi[1] << 8) | (bufi[2] << 16); // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = (float)s / 256; } else // big endian input { int s = (bufi[0] << 16) | (bufi[1] << 8) | bufi[2]; // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = (float)s / 256; } break; case 4: #ifdef WORDS_BIGENDIAN if (!sndf->bigendian) #else if (sndf->bigendian) #endif { // swap bytes int s = *(int *)&bufi; buf[i] = (float)SWAP32(s) / 65536; } else { int s = *(int *)&bufi; buf[i] = (float)s / 65536; } break; default: return 0; } } i++; } if (map) chan_remap((int32_t *)buf, sndf->channels, i / sndf->channels, map); return i; } size_t wav_read_int24(pcmfile_t *sndf, int32_t *buf, size_t num, int *map) { int size; int i; unsigned char *bufi; if ((sndf->samplebytes > 4) || (sndf->samplebytes < 1)) return 0; bufi = (char *)buf + sizeof(*buf) * num - sndf->samplebytes * (num - 1) - sizeof(*buf); size = fread(bufi, sndf->samplebytes, num, sndf->f); // convert to 24 bit // fix endianness switch (sndf->samplebytes) { case 1: /* this is endian clean */ for (i = 0; i < size; i++) buf[i] = (bufi[i] - 128) * 65536; break; case 2: #ifdef WORDS_BIGENDIAN if (!sndf->bigendian) #else if (sndf->bigendian) #endif { // swap bytes for (i = 0; i < size; i++) { int16_t s = ((int16_t *)bufi)[i]; s = SWAP16(s); buf[i] = ((u_int32_t)s) << 8; } } else { // no swap for (i = 0; i < size; i++) { int s = ((int16_t *)bufi)[i]; buf[i] = s << 8; } } break; case 3: if (!sndf->bigendian) { for (i = 0; i < size; i++) { int s = bufi[3 * i] | (bufi[3 * i + 1] << 8) | (bufi[3 * i + 2] << 16); // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = s; } } else // big endian input { for (i = 0; i < size; i++) { int s = (bufi[3 * i] << 16) | (bufi[3 * i + 1] << 8) | bufi[3 * i + 2]; // fix sign if (s & 0x800000) s |= 0xff000000; buf[i] = s; } } break; case 4: #ifdef WORDS_BIGENDIAN if (!sndf->bigendian) #else if (sndf->bigendian) #endif { // swap bytes for (i = 0; i < size; i++) { int s = buf[i]; buf[i] = SWAP32(s); } } break; } if (map) chan_remap(buf, sndf->channels, size / sndf->channels, map); return size; } int wav_close(pcmfile_t *sndf) { int i = fclose(sndf->f); free(sndf); return i; } faac-1.28/frontend/input.h0000644010307701030770000000372411112621753017200 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2002 Krzysztof Nikiel * * 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 * * $Id: input.h,v 1.7 2008/11/24 22:00:11 menno Exp $ */ #ifndef _INPUT_H #define _INPUT_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifndef __MPEG4IP_INCLUDED__ /* Let's avoid some boring conflicting declarations */ #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifndef HAVE_INT32_T typedef signed int int32_t; #endif #ifndef HAVE_INT16_T typedef signed short int16_t; #endif #ifndef HAVE_U_INT32_T typedef unsigned int u_int32_t; #endif #ifndef HAVE_U_INT16_T typedef unsigned short u_int16_t; #endif #endif /* #ifndef __MPEG4IP_INCLUDED__ */ #ifdef __cplusplus extern "C" { #endif typedef struct { FILE *f; int channels; int samplebytes; int samplerate; int samples; int bigendian; int isfloat; } pcmfile_t; pcmfile_t *wav_open_read(const char *path, int rawchans); size_t wav_read_float32(pcmfile_t *sndf, float *buf, size_t num, int *map); size_t wav_read_int24(pcmfile_t *sndf, int32_t *buf, size_t num, int *map); int wav_close(pcmfile_t *file); #ifdef __cplusplus } #endif #endif /* _INPUT_H */ faac-1.28/frontend/main.c0000644010307701030770000011744611136465174017000 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * Copyright (C) 2002-2004 Krzysztof Nikiel * Copyright (C) 2004 Dan Villiom P. Christiansen * * 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 * * $Id: main.c,v 1.82 2009/01/24 01:10:20 menno Exp $ */ #ifdef _MSC_VER # define HAVE_LIBMP4V2 1 #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_LIBMP4V2 # include #endif #define DEFAULT_TNS 0 #ifdef _WIN32 #include #include #else #include #endif /* the BSD derivatives don't define __unix__ */ #if defined(__APPLE__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) #define __unix__ #endif #ifdef __unix__ #include #include #include #include #endif #include #include #include #include #include #ifdef HAVE_GETOPT_H # include #else # include "getopt.h" # include "getopt.c" #endif #if !defined(HAVE_STRCASECMP) && !defined(_WIN32) # define strcasecmp strcmp #endif #ifdef _WIN32 # undef stderr # define stderr stdout #endif #include "input.h" #include const char *usage = "Usage: %s [options] [-o outfile] infiles ...\n" "\n" "\t and/or can be \"-\", which means stdin/stdout.\n" "\n" "See also:\n" "\t\"%s --help\" for short help on using FAAC\n" "\t\"%s --long-help\" for a description of all options for FAAC.\n" "\t\"%s --license\" for the license terms for FAAC.\n\n"; const char *short_help = "Usage: %s [options] infiles ...\n" "Options:\n" " -q \tSet quantizer quality.\n" " -b \tSet average bitrate to x kbps. (ABR, lower quality mode)\n" " -c \tSet the bandwidth in Hz. (default=automatic)\n" " -o X\t\tSet output file to X (only for one input file)\n" " -r\t\tUse RAW AAC output file.\n" " -P\t\tRaw PCM input mode (default 44100Hz 16bit stereo).\n" " -R\t\tRaw PCM input rate.\n" " -B\t\tRaw PCM input sample size (8, 16 (default), 24 or 32bits).\n" " -C\t\tRaw PCM input channels.\n" " -X\t\tRaw PCM swap input bytes\n" " -I \tInput channel config, default is 3,4 (Center third, LF fourth)\n" "\n" "MP4 specific options:\n" #ifdef HAVE_LIBMP4V2 " -w\t\tWrap AAC data in MP4 container. (default for *.mp4 and *.m4a)\n" " -s\t\tOptimize MP4 container layout after encoding\n" " --artist X\tSet artist to X\n" " --writer X\tSet writer to X\n" " --title X\tSet title to X\n" " --genre X\tSet genre to X\n" " --album X\tSet album to X\n" " --compilation\tSet compilation\n" " --track X\tSet track to X (number/total)\n" " --disc X\tSet disc to X (number/total)\n" " --year X\tSet year to X\n" " --cover-art X\tRead cover art from file X\n" " --comment X\tSet comment to X\n" #else " MP4 support unavailable.\n" #endif "\n" "Documentation:\n" " --license\tShow the FAAC license.\n" " --help\tShow this abbreviated help.\n" " --long-help\tShow complete help.\n" "\n" " More tips can be found in the audiocoding.com Knowledge Base at\n" " \n" "\n"; const char *long_help = "Usage: %s [options] infiles ...\n" "\n" "Quality-related options:\n" " -q \tSet default variable bitrate (VBR) quantizer quality in percent.\n" "\t\t(default: 100, averages at approx. 120 kbps VBR for a normal\n" "\t\tstereo input file with 16 bit and 44.1 kHz sample rate; max.\n" "\t\tvalue 500, min. 10).\n" " -b \tSet average bitrate (ABR) to approximately kbps.\n" "\t\t(max. value 152 kbps/stereo with a 16 kHz cutoff, can be raised\n" "\t\twith a higher -c setting).\n" " -c \tSet the bandwidth in Hz (default: automatic, i.e. adapts\n" "\t\tmaximum value to input sample rate).\n" "\n" "Input/output options:\n" " -\t\t: If you simply use a hyphen/minus sign instead\n" "\t\tof an input file name, FAAC can encode directly from stdin,\n" "\t\tthus enabling piping from other applications and utilities. The\n" "\t\tsame works for stdout as well, so FAAC can pipe its output to\n" "\t\tother apps such as a server.\n" " -o X\t\tSet output file to X (only for one input file)\n" "\t\tonly for one input file; you can use *.aac, *.mp4, *.m4a or\n" "\t\t*.m4b as file extension, and the file format will be set\n" "\t\tautomatically to ADTS or MP4).\n" " -P\t\tRaw PCM input mode (default: off, i.e. expecting a WAV header;\n" "\t\tnecessary for input files or bitstreams without a header; using\n" "\t\tonly -P assumes the default values for -R, -B and -C in the\n" "\t\tinput file).\n" " -R\t\tRaw PCM input sample rate in Hz (default: 44100 Hz, max. 96 kHz)\n" " -B\t\tRaw PCM input sample size (default: 16, also possible 8, 24, 32\n" "\t\tbit fixed or float input).\n" " -C\t\tRaw PCM input channels (default: 2, max. 33 + 1 LFE).\n" " -X\t\tRaw PCM swap input bytes (default: bigendian).\n" " -I \tInput multichannel configuration (default: 3,4 which means\n" "\t\tCenter is third and LFE is fourth like in 5.1 WAV, so you only\n" "\t\thave to specify a different position of these two mono channels\n" "\t\tin your multichannel input files if they haven't been reordered\n" "\t\talready).\n" "\n" "MP4 specific options:\n" #ifdef HAVE_LIBMP4V2 " -w\t\tWrap AAC data in MP4 container. (default for *.mp4, *.m4a and\n" "\t\t*.m4b)\n" " -s\t\tOptimize MP4 container layout after encoding.\n" " --artist X\tSet artist to X\n" " --writer X\tSet writer/composer to X\n" " --title X\tSet title/track name to X\n" " --genre X\tSet genre to X\n" " --album X\tSet album/performer to X\n" " --compilation\tMark as compilation\n" " --track X\tSet track to X (number/total)\n" " --disc X\tSet disc to X (number/total)\n" " --year X\tSet year to X\n" " --cover-art X\tRead cover art from file X\n" "\t\tSupported image formats are GIF, JPEG, and PNG.\n" " --comment X\tSet comment to X\n" #else " MP4 support unavailable.\n" #endif "\n" "Expert options, only for testing purposes:\n" #if !DEFAULT_TNS " --tns \tEnable coding of TNS, temporal noise shaping.\n" #else " --no-tns\tDisable coding of TNS, temporal noise shaping.\n" #endif " --no-midside\tDon\'t use mid/side coding.\n" " --mpeg-vers X\tForce AAC MPEG version, X can be 2 or 4\n" " --obj-type X\tAAC object type. (LC (Low Complexity, default), Main or LTP\n" "\t\t(Long Term Prediction)\n" " --shortctl X\tEnforce block type (0 = both (default); 1 = no short; 2 = no\n" "\t\tlong).\n" " -r\t\tGenerate raw AAC bitstream (i.e. without any headers).\n" "\t\tNot advised!!!, RAW AAC files are practically useless!!!\n" "\n" "Documentation:\n" " --license\tShow the FAAC license.\n" " --help\tShow this abbreviated help.\n" " --long-help\tShow complete help.\n" "\n" " More tips can be found in the audiocoding.com Knowledge Base at\n" " \n" "\n"; char *license = "\nPlease note that the use of this software may require the payment of patent\n" "royalties. You need to consider this issue before you start building derivative\n" "works. We are not warranting or indemnifying you in any way for patent\n" "royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!\n" "\n" "FAAC is based on the ISO MPEG-4 reference code. For this code base the\n" "following license applies:\n" "\n" "This software module was originally developed by\n" "\n" "FirstName LastName (CompanyName)\n" "\n" "and edited by\n" "\n" "FirstName LastName (CompanyName)\n" "FirstName LastName (CompanyName)\n" "\n" "in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard\n" "ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an\n" "implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools\n" "as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives\n" "users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this\n" "software module or modifications thereof for use in hardware or\n" "software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio\n" "standards. Those intending to use this software module in hardware or\n" "software products are advised that this use may infringe existing\n" "patents. The original developer of this software module and his/her\n" "company, the subsequent editors and their companies, and ISO/IEC have\n" "no liability for use of this software module or modifications thereof\n" "in an implementation. Copyright is not released for non MPEG-2\n" "NBC/MPEG-4 Audio conforming products. The original developer retains\n" "full right to use the code for his/her own purpose, assign or donate\n" "the code to a third party and to inhibit third party from using the\n" "code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This\n" "copyright notice must be included in all copies or derivative works.\n" "\n" "Copyright (c) 1997.\n" "\n" "For the changes made for the FAAC project the GNU Lesser General Public\n" "License (LGPL), version 2 1991 applies:\n" "\n" "FAAC - Freeware Advanced Audio Coder\n" "Copyright (C) 2001-2004 The individual contributors\n" "\n" "This library is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU Lesser General Public\n" "License as published by the Free Software Foundation; either\n" "version 2.1 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" "\n"; #ifndef min #define min(a,b) ( (a) < (b) ? (a) : (b) ) #endif /* globals */ char* progName; #ifndef _WIN32 volatile int running = 1; #endif enum stream_format { RAW_STREAM = 0, ADTS_STREAM = 1, }; enum container_format { NO_CONTAINER, #ifdef HAVE_LIBMP4V2 MP4_CONTAINER, #endif }; enum flags { SHORTCTL_FLAG = 300, TNS_FLAG = 301, NO_TNS_FLAG = 302, MPEGVERS_FLAG = 303, OBJTYPE_FLAG = 304, NO_MIDSIDE_FLAG = 306, #ifdef HAVE_LIBMP4V2 ARTIST_FLAG = 320, TITLE_FLAG = 321, GENRE_FLAG = 322, ALBUM_FLAG = 323, COMPILATION_FLAG = 324, TRACK_FLAG = 325, DISC_FLAG = 326, YEAR_FLAG = 327, COVER_ART_FLAG = 328, COMMENT_FLAG = 329, WRITER_FLAG = 330, #endif }; #ifndef _WIN32 void signal_handler(int signal) { running = 0; } #endif #ifdef HAVE_LIBMP4V2 static int check_image_header(const char *buf) { if (!strncmp(buf, "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8)) return 1; /* PNG */ else if (!strncmp(buf, "\xFF\xD8\xFF\xE0", 4) || !strncmp(buf, "\xFF\xD8\xFF\xE1", 4)) return 1; /* JPEG */ else if (!strncmp(buf, "GIF87a", 6) || !strncmp(buf, "GIF89a", 6)) return 1; /* GIF */ else return 0; } #endif static int *mkChanMap(int channels, int center, int lf) { int *map; int inpos; int outpos; if (!center && !lf) return NULL; if (channels < 3) return NULL; if (lf > 0) lf--; else lf = channels - 1; // default AAC position if (center > 0) center--; else center = 0; // default AAC position map = malloc(channels * sizeof(map[0])); memset(map, 0, channels * sizeof(map[0])); outpos = 0; if ((center >= 0) && (center < channels)) map[outpos++] = center; inpos = 0; for (; outpos < (channels - 1); inpos++) { if (inpos == center) continue; if (inpos == lf) continue; map[outpos++] = inpos; } if (outpos < channels) { if ((lf >= 0) && (lf < channels)) map[outpos] = lf; else map[outpos] = inpos; } return map; } int main(int argc, char *argv[]) { int frames, currentFrame; faacEncHandle hEncoder; pcmfile_t *infile = NULL; unsigned long samplesInput, maxBytesOutput, totalBytesWritten=0; faacEncConfigurationPtr myFormat; unsigned int mpegVersion = MPEG2; unsigned int objectType = LOW; unsigned int useMidSide = 1; static unsigned int useTns = DEFAULT_TNS; enum container_format container = NO_CONTAINER; int optimizeFlag = 0; enum stream_format stream = ADTS_STREAM; int cutOff = -1; int bitRate = 0; unsigned long quantqual = 0; int chanC = 3; int chanLF = 4; char *audioFileName = NULL; char *aacFileName = NULL; char *aacFileExt = NULL; int aacFileNameGiven = 0; float *pcmbuf; int *chanmap = NULL; unsigned char *bitbuf; int samplesRead = 0; const char *dieMessage = NULL; int rawChans = 0; // disabled by default int rawBits = 16; int rawRate = 44100; int rawEndian = 1; int shortctl = SHORTCTL_NORMAL; FILE *outfile = NULL; #ifdef HAVE_LIBMP4V2 MP4FileHandle MP4hFile = MP4_INVALID_FILE_HANDLE; MP4TrackId MP4track = 0; unsigned int ntracks = 0, trackno = 0; unsigned int ndiscs = 0, discno = 0; u_int8_t compilation = 0; const char *artist = NULL, *title = NULL, *album = NULL, *year = NULL, *genre = NULL, *comment = NULL, *writer = NULL; u_int8_t *art = NULL; u_int64_t artSize = 0; u_int64_t total_samples = 0; u_int64_t encoded_samples = 0; unsigned int delay_samples; unsigned int frameSize; #endif char *faac_id_string; char *faac_copyright_string; #ifndef _WIN32 // install signal handler signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); #endif // get faac version if (faacEncGetVersion(&faac_id_string, &faac_copyright_string) == FAAC_CFG_VERSION) { fprintf(stderr, "Freeware Advanced Audio Coder\nFAAC %s\n\n", faac_id_string); } else { fprintf(stderr, __FILE__ "(%d): wrong libfaac version\n", __LINE__); return 1; } /* begin process command line */ progName = argv[0]; while (1) { static struct option long_options[] = { { "help", 0, 0, 'h'}, { "long-help", 0, 0, 'H'}, { "raw", 0, 0, 'r'}, { "no-midside", 0, 0, NO_MIDSIDE_FLAG}, { "cutoff", 1, 0, 'c'}, { "quality", 1, 0, 'q'}, { "pcmraw", 0, 0, 'P'}, { "pcmsamplerate", 1, 0, 'R'}, { "pcmsamplebits", 1, 0, 'B'}, { "pcmchannels", 1, 0, 'C'}, { "shortctl", 1, 0, SHORTCTL_FLAG}, { "tns", 0, 0, TNS_FLAG}, { "no-tns", 0, 0, NO_TNS_FLAG}, { "mpeg-version", 1, 0, MPEGVERS_FLAG}, { "obj-type", 1, 0, OBJTYPE_FLAG}, { "license", 0, 0, 'L'}, #ifdef HAVE_LIBMP4V2 { "createmp4", 0, 0, 'w'}, { "optimize", 0, 0, 's'}, { "artist", 1, 0, ARTIST_FLAG}, { "title", 1, 0, TITLE_FLAG}, { "album", 1, 0, ALBUM_FLAG}, { "track", 1, 0, TRACK_FLAG}, { "disc", 1, 0, DISC_FLAG}, { "genre", 1, 0, GENRE_FLAG}, { "year", 1, 0, YEAR_FLAG}, { "cover-art", 1, 0, COVER_ART_FLAG}, { "comment", 1, 0, COMMENT_FLAG}, { "writer", 1, 0, WRITER_FLAG}, { "compilation", 0, 0, COMPILATION_FLAG}, #endif { "pcmswapbytes", 0, 0, 'X'}, { 0, 0, 0, 0} }; int c = -1; int option_index = 0; c = getopt_long(argc, argv, "Hhb:m:o:rnc:q:PR:B:C:I:X" #ifdef HAVE_LIBMP4V2 "ws" #endif ,long_options, &option_index); if (c == -1) break; if (!c) { dieMessage = usage; break; } switch (c) { case 'o': { int l = strlen(optarg); aacFileName = malloc(l+1); memcpy(aacFileName, optarg, l); aacFileName[l] = '\0'; aacFileNameGiven = 1; } break; case 'r': { stream = RAW_STREAM; break; } case NO_MIDSIDE_FLAG: { useMidSide = 0; break; } case 'c': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) { cutOff = i; } break; } case 'b': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) { bitRate = 1000 * i; } break; } case 'q': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) { if (i > 0 && i < 1000) quantqual = i; } break; } case 'I': sscanf(optarg, "%d,%d", &chanC, &chanLF); break; case 'P': rawChans = 2; // enable raw input break; case 'R': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) { rawRate = i; rawChans = (rawChans > 0) ? rawChans : 2; } break; } case 'B': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) { if (i > 32) i = 32; if (i < 8) i = 8; rawBits = i; rawChans = (rawChans > 0) ? rawChans : 2; } break; } case 'C': { unsigned int i; if (sscanf(optarg, "%u", &i) > 0) rawChans = i; break; } #ifdef HAVE_LIBMP4V2 case 'w': container = MP4_CONTAINER; break; case 's': optimizeFlag = 1; break; case ARTIST_FLAG: artist = optarg; break; case WRITER_FLAG: writer = optarg; break; case TITLE_FLAG: title = optarg; break; case ALBUM_FLAG: album = optarg; break; case TRACK_FLAG: sscanf(optarg, "%d/%d", &trackno, &ntracks); break; case DISC_FLAG: sscanf(optarg, "%d/%d", &discno, &ndiscs); break; case COMPILATION_FLAG: compilation = 0x1; break; case GENRE_FLAG: genre = optarg; break; case YEAR_FLAG: year = optarg; break; case COMMENT_FLAG: comment = optarg; break; case COVER_ART_FLAG: { FILE *artFile = fopen(optarg, "rb"); if(artFile) { u_int64_t r; fseek(artFile, 0, SEEK_END); artSize = ftell(artFile); art = malloc(artSize); fseek(artFile, 0, SEEK_SET); clearerr(artFile); r = fread(art, artSize, 1, artFile); if (r != 1) { dieMessage = "Error reading cover art file!\n"; free(art); art = NULL; } else if (artSize < 12 || !check_image_header(art)) { /* the above expression checks the image signature */ dieMessage = "Unsupported cover image file format!\n"; free(art); art = NULL; } fclose(artFile); } else { dieMessage = "Error opening cover art file!\n"; } break; } #endif case SHORTCTL_FLAG: shortctl = atoi(optarg); break; case TNS_FLAG: useTns = 1; break; case NO_TNS_FLAG: useTns = 0; break; case MPEGVERS_FLAG: mpegVersion = atoi(optarg); switch(mpegVersion) { case 2: mpegVersion = MPEG2; break; case 4: mpegVersion = MPEG4; break; default: dieMessage = "Unrecognised MPEG version!\n"; } break; #if 0 case OBJTYPE_FLAG: if (!strcasecmp(optarg, "LC")) objectType = LOW; else if (!strcasecmp(optarg, "Main")) objectType = MAIN; else if (!strcasecmp(optarg, "LTP")) { mpegVersion = MPEG4; objectType = LTP; } else dieMessage = "Unrecognised object type!\n"; break; #endif case 'L': fprintf(stderr, faac_copyright_string); dieMessage = license; break; case 'X': rawEndian = 0; break; case 'H': dieMessage = long_help; break; case 'h': dieMessage = short_help; break; case '?': default: dieMessage = usage; break; } } /* check that we have at least one non-option arguments */ if (!dieMessage && (argc - optind) > 1 && aacFileNameGiven) dieMessage = "Cannot encode several input files to one output file.\n"; if (argc - optind < 1 || dieMessage) { fprintf(stderr, dieMessage ? dieMessage : usage, progName, progName, progName, progName); return 1; } while (argc - optind > 0) { /* get the input file name */ audioFileName = argv[optind++]; /* generate the output file name, if necessary */ if (!aacFileNameGiven) { char *t = strrchr(audioFileName, '.'); int l = t ? strlen(audioFileName) - strlen(t) : strlen(audioFileName); #ifdef HAVE_LIBMP4V2 aacFileExt = container == MP4_CONTAINER ? ".m4a" : ".aac"; #else aacFileExt = ".aac"; #endif aacFileName = malloc(l+1+4); memcpy(aacFileName, audioFileName, l); memcpy(aacFileName + l, aacFileExt, 4); aacFileName[l+4] = '\0'; } else { aacFileExt = strrchr(aacFileName, '.'); if (aacFileExt && (!strcmp(".m4a", aacFileExt) || !strcmp(".m4b", aacFileExt) || !strcmp(".mp4", aacFileExt))) #ifndef HAVE_LIBMP4V2 fprintf(stderr, "WARNING: MP4 support unavailable!\n"); #else container = MP4_CONTAINER; #endif } /* open the audio input file */ if (rawChans > 0) // use raw input { infile = wav_open_read(audioFileName, 1); if (infile) { infile->bigendian = rawEndian; infile->channels = rawChans; infile->samplebytes = rawBits / 8; infile->samplerate = rawRate; infile->samples /= (infile->channels * infile->samplebytes); } } else // header input infile = wav_open_read(audioFileName, 0); if (infile == NULL) { fprintf(stderr, "Couldn't open input file %s\n", audioFileName); return 1; } /* open the encoder library */ hEncoder = faacEncOpen(infile->samplerate, infile->channels, &samplesInput, &maxBytesOutput); #ifdef HAVE_LIBMP4V2 if (container != MP4_CONTAINER && (ntracks || trackno || artist || title || album || year || art || genre || comment || discno || ndiscs || writer || compilation)) { fprintf(stderr, "Metadata requires MP4 output!\n"); return 1; } if (container == MP4_CONTAINER) { mpegVersion = MPEG4; stream = RAW_STREAM; } frameSize = samplesInput/infile->channels; delay_samples = frameSize; // encoder delay 1024 samples #endif pcmbuf = (float *)malloc(samplesInput*sizeof(float)); bitbuf = (unsigned char*)malloc(maxBytesOutput*sizeof(unsigned char)); chanmap = mkChanMap(infile->channels, chanC, chanLF); if (chanmap) { fprintf(stderr, "Remapping input channels: Center=%d, LFE=%d\n", chanC, chanLF); } if (cutOff <= 0) { if (cutOff < 0) // default cutOff = 0; else // disabled cutOff = infile->samplerate / 2; } if (cutOff > (infile->samplerate / 2)) cutOff = infile->samplerate / 2; /* put the options in the configuration struct */ myFormat = faacEncGetCurrentConfiguration(hEncoder); myFormat->aacObjectType = objectType; myFormat->mpegVersion = mpegVersion; myFormat->useTns = useTns; switch (shortctl) { case SHORTCTL_NOSHORT: fprintf(stderr, "disabling short blocks\n"); myFormat->shortctl = shortctl; break; case SHORTCTL_NOLONG: fprintf(stderr, "disabling long blocks\n"); myFormat->shortctl = shortctl; break; } if (infile->channels >= 6) myFormat->useLfe = 1; myFormat->allowMidside = useMidSide; if (bitRate) myFormat->bitRate = bitRate / infile->channels; myFormat->bandWidth = cutOff; if (quantqual > 0) myFormat->quantqual = quantqual; myFormat->outputFormat = stream; myFormat->inputFormat = FAAC_INPUT_FLOAT; if (!faacEncSetConfiguration(hEncoder, myFormat)) { fprintf(stderr, "Unsupported output format!\n"); #ifdef HAVE_LIBMP4V2 if (container == MP4_CONTAINER) MP4Close(MP4hFile); #endif return 1; } #ifdef HAVE_LIBMP4V2 /* initialize MP4 creation */ if (container == MP4_CONTAINER) { unsigned char *ASC = 0; unsigned long ASCLength = 0; char *version_string; #ifdef MP4_CREATE_EXTENSIBLE_FORMAT /* hack to compile against libmp4v2 >= 1.0RC3 * why is there no version identifier in mp4.h? */ MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0); #else MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0, 0); #endif if (!MP4_IS_VALID_FILE_HANDLE(MP4hFile)) { fprintf(stderr, "Couldn't create output file %s\n", aacFileName); return 1; } MP4SetTimeScale(MP4hFile, 90000); MP4track = MP4AddAudioTrack(MP4hFile, infile->samplerate, MP4_INVALID_DURATION, MP4_MPEG4_AUDIO_TYPE); MP4SetAudioProfileLevel(MP4hFile, 0x0F); faacEncGetDecoderSpecificInfo(hEncoder, &ASC, &ASCLength); MP4SetTrackESConfiguration(MP4hFile, MP4track, ASC, ASCLength); free(ASC); /* set metadata */ version_string = malloc(strlen(faac_id_string) + 6); strcpy(version_string, "FAAC "); strcpy(version_string + 5, faac_id_string); MP4SetMetadataTool(MP4hFile, version_string); free(version_string); if (artist) MP4SetMetadataArtist(MP4hFile, artist); if (writer) MP4SetMetadataWriter(MP4hFile, writer); if (title) MP4SetMetadataName(MP4hFile, title); if (album) MP4SetMetadataAlbum(MP4hFile, album); if (trackno > 0) MP4SetMetadataTrack(MP4hFile, trackno, ntracks); if (discno > 0) MP4SetMetadataDisk(MP4hFile, discno, ndiscs); if (compilation) MP4SetMetadataCompilation(MP4hFile, compilation); if (year) MP4SetMetadataYear(MP4hFile, year); if (genre) MP4SetMetadataGenre(MP4hFile, genre); if (comment) MP4SetMetadataComment(MP4hFile, comment); if (artSize) { MP4SetMetadataCoverArt(MP4hFile, art, artSize); free(art); } } else { #endif /* open the aac output file */ if (!strcmp(aacFileName, "-")) { outfile = stdout; } else { outfile = fopen(aacFileName, "wb"); } if (!outfile) { fprintf(stderr, "Couldn't create output file %s\n", aacFileName); return 1; } #ifdef HAVE_LIBMP4V2 } #endif cutOff = myFormat->bandWidth; quantqual = myFormat->quantqual; bitRate = myFormat->bitRate; if (bitRate) fprintf(stderr, "Average bitrate: %d kbps\n", (bitRate + 500)/1000*infile->channels); fprintf(stderr, "Quantization quality: %ld\n", quantqual); fprintf(stderr, "Bandwidth: %d Hz\n", cutOff); fprintf(stderr, "Object type: "); switch(objectType) { case LOW: fprintf(stderr, "Low Complexity"); break; case MAIN: fprintf(stderr, "Main"); break; case LTP: fprintf(stderr, "LTP"); break; } fprintf(stderr, "(MPEG-%d)", (mpegVersion == MPEG4) ? 4 : 2); if (myFormat->useTns) fprintf(stderr, " + TNS"); if (myFormat->allowMidside) fprintf(stderr, " + M/S"); fprintf(stderr, "\n"); fprintf(stderr, "Container format: "); switch(container) { case NO_CONTAINER: switch(stream) { case RAW_STREAM: fprintf(stderr, "Headerless AAC (RAW)\n"); break; case ADTS_STREAM: fprintf(stderr, "Transport Stream (ADTS)\n"); break; } break; #ifdef HAVE_LIBMP4V2 case MP4_CONTAINER: fprintf(stderr, "MPEG-4 File Format (MP4)\n"); break; #endif } if (outfile #ifdef HAVE_LIBMP4V2 || MP4hFile != MP4_INVALID_FILE_HANDLE #endif ) { int showcnt = 0; #ifdef _WIN32 long begin = GetTickCount(); #endif if (infile->samples) frames = ((infile->samples + 1023) / 1024) + 1; else frames = 0; currentFrame = 0; fprintf(stderr, "Encoding %s to %s\n", audioFileName, aacFileName); if (frames != 0) fprintf(stderr, " frame | bitrate | elapsed/estim | " "play/CPU | ETA\n"); else fprintf(stderr, " frame | elapsed | play/CPU\n"); /* encoding loop */ #ifdef _WIN32 for (;;) #else while (running) #endif { int bytesWritten; samplesRead = wav_read_float32(infile, pcmbuf, samplesInput, chanmap); #ifdef HAVE_LIBMP4V2 total_samples += samplesRead / infile->channels; #endif /* call the actual encoding routine */ bytesWritten = faacEncEncode(hEncoder, (int32_t *)pcmbuf, samplesRead, bitbuf, maxBytesOutput); if (bytesWritten) { currentFrame++; showcnt--; totalBytesWritten += bytesWritten; } if ((showcnt <= 0) || !bytesWritten) { double timeused; #ifdef __unix__ struct rusage usage; #endif #ifdef _WIN32 char percent[MAX_PATH + 20]; timeused = (GetTickCount() - begin) * 1e-3; #else #ifdef __unix__ if (getrusage(RUSAGE_SELF, &usage) == 0) { timeused = (double)usage.ru_utime.tv_sec + (double)usage.ru_utime.tv_usec * 1e-6; } else timeused = 0; #else timeused = (double)clock() * (1.0 / CLOCKS_PER_SEC); #endif #endif if (currentFrame && (timeused > 0.1)) { showcnt += 50; if (frames != 0) fprintf(stderr, "\r%5d/%-5d (%3d%%)| %5.1f | %6.1f/%-6.1f | %7.2fx | %.1f ", currentFrame, frames, currentFrame*100/frames, ((double)totalBytesWritten * 8.0 / 1000.0) / ((double)infile->samples / infile->samplerate * currentFrame / frames), timeused, timeused * frames / currentFrame, (1024.0 * currentFrame / infile->samplerate) / timeused, timeused * (frames - currentFrame) / currentFrame); else fprintf(stderr, "\r %5d | %6.1f | %7.2fx ", currentFrame, timeused, (1024.0 * currentFrame / infile->samplerate) / timeused); fflush(stderr); #ifdef _WIN32 if (frames != 0) { sprintf(percent, "%.2f%% encoding %s", 100.0 * currentFrame / frames, audioFileName); SetConsoleTitle(percent); } #endif } } /* all done, bail out */ if (!samplesRead && !bytesWritten) break ; if (bytesWritten < 0) { fprintf(stderr, "faacEncEncode() failed\n"); break ; } if (bytesWritten > 0) { #ifdef HAVE_LIBMP4V2 u_int64_t samples_left = total_samples - encoded_samples + delay_samples; MP4Duration dur = samples_left > frameSize ? frameSize : samples_left; MP4Duration ofs = encoded_samples > 0 ? 0 : delay_samples; if (container == MP4_CONTAINER) { /* write bitstream to mp4 file */ MP4WriteSample(MP4hFile, MP4track, bitbuf, bytesWritten, dur, ofs, 1); } else { #endif /* write bitstream to aac file */ fwrite(bitbuf, 1, bytesWritten, outfile); #ifdef HAVE_LIBMP4V2 } encoded_samples += dur; #endif } } #ifdef HAVE_LIBMP4V2 /* clean up */ if (container == MP4_CONTAINER) { MP4Close(MP4hFile); if (optimizeFlag == 1) { fprintf(stderr, "\n\nMP4 format optimization... "); MP4Optimize(aacFileName, NULL, 0); fprintf(stderr, "Done!"); } } else #endif fclose(outfile); fprintf(stderr, "\n\n"); } faacEncClose(hEncoder); wav_close(infile); if (pcmbuf) free(pcmbuf); if (bitbuf) free(bitbuf); if (aacFileNameGiven) free(aacFileName); } return 0; } /* $Log: main.c,v $ Revision 1.82 2009/01/24 01:10:20 menno Made JPEG detection less restrictive Revision 1.81 2009/01/24 00:15:12 menno Added -s option for output of optimized mp4 layout Revision 1.80 2007/03/19 19:57:40 menno Made faacgui buildable again Made stdout as output possible (use - as output filename) Disabled MAIN and LTP encoding Increase version number Revision 1.79 2006/09/25 19:53:36 menno Fixed track and disk number reading from command line Revision 1.78 2004/12/08 11:07:17 menno Make long help work again Revision 1.77 2004/08/19 15:33:30 menno typo it's not bad to have this option, but people should be warned that they can get severe playback problems with RAW AAC files (anything other then 44100 will not be decoded properly unless you know that it has that samplerate). Seeking is also not possible on these files. Revision 1.76 2004/08/19 13:18:44 menno Removed stupid comment in help of FAAC. RAW AAC files are USELESS, it seems that already some people encoded their collection using the -r option. Revision 1.75 2004/08/06 19:33:19 danchr TNS is no longer enabled by default (reported by guruboolez) documentation fixes in frontend default to mp4 for *.m4b as well Revision 1.74 2004/08/03 00:08:51 danchr fix --shortctl documentation Revision 1.73 2004/08/02 20:53:23 danchr *BSD portability fix Revision 1.72 2004/08/02 20:41:59 danchr NetBSD portability fix + fixing metadata bugs w/ sscanf() Revision 1.71 2004/07/28 08:18:21 danchr Darwin portability fixes, should help on Linux too Revision 1.70 2004/05/03 11:39:05 danchr fix documentation bugs (per Hans-Jrgen's suggestions) enable (preliminary) multiple output file support Revision 1.69 2004/04/22 14:07:14 danchr set copyright notice to my full name Revision 1.68 2004/04/16 14:51:10 danchr don't use stderr on Windows Revision 1.67 2004/04/16 09:49:10 danchr change -a to -b Darwin portability fixes Make LTP imply MPEG-4 AAC silence a few warnings Revision 1.66 2004/04/13 13:47:05 danchr compilation and composer patch by Jordan Breeding undocumented single-letter switches removed numerous bug-fixes Revision 1.65 2004/04/03 17:47:40 danchr fix typo + add GIF support Revision 1.64 2004/04/03 15:54:48 danchr make TNS default Revision 1.63 2004/04/03 15:50:05 danchr non-backwards compatible revamp of the FAAC command line interface cover art metadata support based on patch by Jordan Breeding (jordan breeding (a) mac com) Revision 1.62 2004/03/29 14:02:04 danchr MP4 bug fixes by Jordan Breeding (jordan breeding (a) mac com) Document long options for metadata - they are much more intuitive. Revision 1.61 2004/03/27 13:44:24 danchr minor compile-time bugfix for Win32 Revision 1.60 2004/03/24 15:44:08 danchr fixing WIN32 -> _WIN32 Revision 1.59 2004/03/24 11:09:06 danchr prettify the way stream format is handled - this just *might* fix a bug Revision 1.58 2004/03/24 11:00:40 danchr silence a few warnings and fix a few mem. leaks make it possible to disable stripping (needed for profiling and debugging) Revision 1.57 2004/03/17 13:32:13 danchr - New signal handler. Disabled on Windows, although it *should* work. - Separated handling of stream format and output format. - Bitrate + file format displayed on stderr. - knik and myself added to the copyright header. Revision 1.56 2004/03/15 20:15:48 knik improved MP4 support by Dan Christiansen Revision 1.55 2004/03/03 15:54:50 knik libmp4v2 autoconf detection and mp4 metadata support by Dan Christiansen Revision 1.54 2004/02/14 10:31:23 knik Print help and exit when unknown option is specified. Revision 1.53 2003/12/20 04:32:48 stux i've added sms00's OSX patch to faac Revision 1.52 2003/12/14 12:25:44 ca5e Gapless MP4 handling method changed again... Revision 1.51 2003/12/13 21:58:35 ca5e Improved gapless encoding Revision 1.50 2003/11/24 18:11:14 knik using new version info interface Revision 1.49 2003/11/13 18:30:19 knik raw input bugfix Revision 1.48 2003/10/17 17:11:18 knik fixed raw input Revision 1.47 2003/10/12 14:30:29 knik more accurate average bitrate control Revision 1.46 2003/09/24 16:30:34 knik Added option to enforce block type. Revision 1.45 2003/09/08 16:28:21 knik conditional libmp4v2 compilation Revision 1.44 2003/09/07 17:44:36 ca5e length calculations/silence padding changed to match current libfaac behavior changed tabs to spaces, fixes to indentation Revision 1.43 2003/08/17 19:38:15 menno fixes to MP4 files by Case Revision 1.41 2003/08/15 11:43:14 knik Option to add a number of silent frames at the end of output. Small TNS option fix. Revision 1.40 2003/08/07 11:28:06 knik fixed win32 crash with long filenames Revision 1.39 2003/07/21 16:33:49 knik Fixed LFE channel mapping. Revision 1.38 2003/07/13 08:34:43 knik Fixed -o, -m and -I option. Print object type setting. Revision 1.37 2003/07/10 19:19:32 knik Input channel remapping and 24-bit support. Revision 1.36 2003/06/26 19:40:53 knik TNS disabled by default. Copyright info moved to library. Print help to standard output. Revision 1.35 2003/06/21 08:59:31 knik raw input support moved to input.c Revision 1.34 2003/05/10 09:40:35 knik added approximate ABR option Revision 1.33 2003/04/13 08:39:28 knik removed psymodel setting Revision 1.32 2003/03/27 17:11:06 knik updated library interface -b bitrate option replaced with -q quality option TNS enabled by default Revision 1.31 2002/12/23 19:02:43 knik added some headers Revision 1.30 2002/12/15 15:16:55 menno Some portability changes Revision 1.29 2002/11/23 17:34:59 knik replaced libsndfile with input.c improved bandwidth/bitrate calculation formula Revision 1.28 2002/08/30 16:20:45 knik misplaced #endif Revision 1.27 2002/08/19 16:33:54 knik automatic bitrate setting more advanced status line */ faac-1.28/frontend/maingui.c0000644010307701030770000003314110577565464017505 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: maingui.c,v 1.21 2007/03/19 19:57:40 menno Exp $ */ #include #include #include #include #include "input.h" #include #include "resource.h" static HINSTANCE hInstance; static char inputFilename[_MAX_PATH], outputFilename[_MAX_PATH]; static BOOL Encoding = FALSE; static BOOL SelectFileName(HWND hParent, char *filename, BOOL forReading) { OPENFILENAME ofn; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hParent; ofn.hInstance = hInstance; ofn.nFilterIndex = 0; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 31; filename [0] = 0x00; ofn.lpstrFile = (LPSTR)filename; ofn.nMaxFile = _MAX_PATH; ofn.lpstrInitialDir = NULL; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lCustData = 0; ofn.lpfnHook = NULL; ofn.lpTemplateName = NULL; if (forReading) { char filters[] = { "Wave Files (*.wav)\0*.wav\0" \ "AIFF Files (*.aif;*.aiff;*.aifc)\0*.aif;*.aiff;*.aifc\0" \ "AU Files (*.au)\0*.au\0" \ "All Files (*.*)\0*.*\0\0" }; ofn.lpstrFilter = filters; ofn.lpstrDefExt = "wav"; ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.lpstrTitle = "Select Source File"; return GetOpenFileName (&ofn); } else { char filters [] = { "AAC Files (*.aac)\0*.aac\0" \ "All Files (*.*)\0*.*\0\0" }; ofn.lpstrFilter = filters; ofn.lpstrDefExt = "aac"; ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; ofn.lpstrTitle = "Select Output File"; return GetSaveFileName(&ofn); } } static void AwakeDialogControls(HWND hWnd) { char szTemp[64]; pcmfile_t *infile = NULL; unsigned int sampleRate, numChannels; char *pExt; if ((infile = wav_open_read(inputFilename, 0)) == NULL) return; /* determine input file parameters */ sampleRate = infile->samplerate; numChannels = infile->channels; wav_close(infile); SetDlgItemText (hWnd, IDC_INPUTFILENAME, inputFilename); strncpy(outputFilename, inputFilename, sizeof(outputFilename) - 5); pExt = strrchr(outputFilename, '.'); if (pExt == NULL) lstrcat(outputFilename, ".aac"); else lstrcpy(pExt, ".aac"); EnableWindow(GetDlgItem(hWnd, IDC_OUTPUTFILENAME), TRUE); EnableWindow(GetDlgItem(hWnd, IDC_SELECT_OUTPUTFILE), TRUE); SetDlgItemText(hWnd, IDC_OUTPUTFILENAME, outputFilename); wsprintf(szTemp, "%iHz %ich", sampleRate, numChannels); SetDlgItemText(hWnd, IDC_INPUTPARAMS, szTemp); EnableWindow(GetDlgItem(hWnd, IDOK), TRUE); } static DWORD WINAPI EncodeFile(LPVOID pParam) { HWND hWnd = (HWND) pParam; pcmfile_t *infile = NULL; GetDlgItemText(hWnd, IDC_INPUTFILENAME, inputFilename, sizeof(inputFilename)); GetDlgItemText(hWnd, IDC_OUTPUTFILENAME, outputFilename, sizeof(outputFilename)); /* open the input file */ if ((infile = wav_open_read(inputFilename, 0)) != NULL) { /* determine input file parameters */ unsigned int sampleRate = infile->samplerate; unsigned int numChannels = infile->channels; unsigned long inputSamples; unsigned long maxOutputBytes; /* open and setup the encoder */ faacEncHandle hEncoder = faacEncOpen(sampleRate, numChannels, &inputSamples, &maxOutputBytes); if (hEncoder) { HANDLE hOutfile; char szTemp[256]; /* set encoder configuration */ faacEncConfigurationPtr config = faacEncGetCurrentConfiguration(hEncoder); config->allowMidside = IsDlgButtonChecked(hWnd, IDC_ALLOWMIDSIDE) == BST_CHECKED ? 1 : 0; config->useTns = IsDlgButtonChecked(hWnd, IDC_USETNS) == BST_CHECKED ? 1 : 0; config->useLfe = IsDlgButtonChecked(hWnd, IDC_USELFE) == BST_CHECKED ? 1 : 0; config->outputFormat = IsDlgButtonChecked(hWnd, IDC_USERAW) == BST_CHECKED ? 0 : 1; config->mpegVersion = SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_GETCURSEL, 0, 0); config->aacObjectType = SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_GETCURSEL, 0, 0); if (config->aacObjectType == SSR) /* Set to LTP */ config->aacObjectType = LTP; GetDlgItemText(hWnd, IDC_QUALITY, szTemp, sizeof(szTemp)); config->quantqual = atoi(szTemp); if (IsDlgButtonChecked(hWnd, IDC_BWCTL) == BST_CHECKED) { GetDlgItemText(hWnd, IDC_BANDWIDTH, szTemp, sizeof(szTemp)); config->bandWidth = atoi(szTemp); } else config->bandWidth = 0; if (!faacEncSetConfiguration(hEncoder, config)) { faacEncClose(hEncoder); wav_close(infile); MessageBox (hWnd, "faacEncSetConfiguration failed!", "Error", MB_OK | MB_ICONSTOP); SendMessage(hWnd,WM_SETTEXT,0,(long)"FAAC GUI"); Encoding = FALSE; SetDlgItemText(hWnd, IDOK, "Encode"); return 0; } sprintf(szTemp, "%ld", config->quantqual); SetDlgItemText(hWnd, IDC_QUALITY, szTemp); sprintf(szTemp, "%d", config->bandWidth); SetDlgItemText(hWnd, IDC_BANDWIDTH, szTemp); /* open the output file */ hOutfile = CreateFile(outputFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hOutfile != INVALID_HANDLE_VALUE) { UINT startTime = GetTickCount(), lastUpdated = 50; DWORD totalBytesRead = 0; unsigned int bytesInput = 0; DWORD numberOfBytesWritten = 0; int *pcmbuf; unsigned char *bitbuf; char HeaderText[50]; char Percentage[5]; pcmbuf = (short*)LocalAlloc(0, inputSamples*sizeof(int)); bitbuf = (unsigned char*)LocalAlloc(0, maxOutputBytes*sizeof(unsigned char)); SendDlgItemMessage(hWnd, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 1024)); SendDlgItemMessage(hWnd, IDC_PROGRESS, PBM_SETPOS, 0, 0); for ( ;; ) { int bytesWritten; UINT timeElapsed, timeEncoded; bytesInput = wav_read_int24(infile, pcmbuf, inputSamples, NULL) * sizeof(int); SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, (unsigned long)((float)totalBytesRead * 1024.0f / (infile->samples*sizeof(int)*numChannels)), 0); /* Percentage for Dialog Output */ _itoa((int)((float)totalBytesRead * 100.0f / (infile->samples*sizeof(int)*numChannels)),Percentage,10); lstrcpy(HeaderText,"FAAC GUI: "); lstrcat(HeaderText,Percentage); lstrcat(HeaderText,"%"); SendMessage(hWnd,WM_SETTEXT,0,(long)HeaderText); totalBytesRead += bytesInput; timeElapsed = (GetTickCount () - startTime) / 10; timeEncoded = 100.0 * totalBytesRead / (sampleRate * numChannels * sizeof (int)); if (timeElapsed > (lastUpdated + 20)) { float factor; unsigned timeLeft; lastUpdated = timeElapsed; factor = (float) timeEncoded / (float) (timeElapsed ? timeElapsed : 1); timeLeft = 10.0 * infile->samples / sampleRate / factor - 0.1 * timeElapsed; sprintf(szTemp, "Playing time: %2.2i:%04.1f\tEncoding time: %2.2i:%04.1f\n" "Play/enc factor: %.2f\tEstimated time left: %2.2i:%04.1f", timeEncoded / 6000, 0.01 * (timeEncoded % 6000), timeElapsed / 6000, 0.01 * (timeElapsed % 6000), factor, timeLeft / 600, 0.1 * (timeLeft % 600) ); SetDlgItemText(hWnd, IDC_TIME, szTemp); } /* call the actual encoding routine */ bytesWritten = faacEncEncode(hEncoder, pcmbuf, bytesInput/sizeof(int), bitbuf, maxOutputBytes); /* Stop Pressed */ if ( !Encoding ) break; /* all done, bail out */ if (!bytesInput && !bytesWritten) break; if (bytesWritten < 0) { MessageBox (hWnd, "faacEncEncodeFrame failed!", "Error", MB_OK | MB_ICONSTOP); break; } WriteFile(hOutfile, bitbuf, bytesWritten, &numberOfBytesWritten, NULL); } CloseHandle(hOutfile); if (pcmbuf) LocalFree(pcmbuf); if (bitbuf) LocalFree(bitbuf); } faacEncClose(hEncoder); } wav_close(infile); MessageBeep(1); SendDlgItemMessage(hWnd, IDC_PROGRESS, PBM_SETPOS, 0, 0); } else { MessageBox(hWnd, "Couldn't open input file!", "Error", MB_OK | MB_ICONSTOP); } SendMessage(hWnd,WM_SETTEXT,0,(long)"FAAC GUI"); Encoding = FALSE; SetDlgItemText(hWnd, IDOK, "Encode"); return 0; } static BOOL WINAPI DialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { unsigned long samplesInput, maxBytesOutput; faacEncHandle hEncoder = faacEncOpen(44100, 2, &samplesInput, &maxBytesOutput); faacEncConfigurationPtr myFormat = faacEncGetCurrentConfiguration(hEncoder); if (myFormat->version == FAAC_CFG_VERSION) { char txt[100]; sprintf(txt, "libfaac version %s", myFormat->name); SetDlgItemText(hWnd, IDC_COMPILEDATE, txt); } else { MessageBox(hWnd, "wrong libfaac version", "FAAC", MB_OK | MB_ICONERROR); PostMessage(hWnd, WM_CLOSE, 0, 0); } faacEncClose(hEncoder); } inputFilename[0] = 0x00; SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"MPEG4"); SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"MPEG2"); SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_SETCURSEL, 0, 0); // SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"Main"); SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"Low Complexity"); // SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"LTP"); SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_SETCURSEL, 0, 0); CheckDlgButton(hWnd, IDC_ALLOWMIDSIDE, TRUE); CheckDlgButton(hWnd, IDC_USELFE, FALSE); CheckDlgButton(hWnd, IDC_USERAW, FALSE); CheckDlgButton(hWnd, IDC_USETNS, TRUE); SetDlgItemText(hWnd, IDC_QUALITY, "100"); SetDlgItemText(hWnd, IDC_BANDWIDTH, "0"); DragAcceptFiles(hWnd, TRUE); return TRUE; case WM_DROPFILES: if (DragQueryFile((HDROP) wParam, 0, (LPSTR) inputFilename, _MAX_PATH - 1)) AwakeDialogControls(hWnd); DragFinish((HDROP) wParam); return FALSE; case WM_COMMAND: switch (wParam) { case IDOK: if ( !Encoding ) { DWORD retval; CreateThread(NULL,0,EncodeFile,hWnd,0,&retval); Encoding = TRUE; SetDlgItemText(hWnd, IDOK, "Stop"); } else { Encoding = FALSE; SetDlgItemText(hWnd, IDOK, "Encode"); } return TRUE; case IDCANCEL: EndDialog(hWnd, TRUE); return TRUE; case IDC_SELECT_INPUTFILE: if (SelectFileName(hWnd, inputFilename, TRUE)) AwakeDialogControls(hWnd); break; case IDC_SELECT_OUTPUTFILE: if (SelectFileName(hWnd, outputFilename, FALSE)) { SetDlgItemText(hWnd, IDC_OUTPUTFILENAME, outputFilename); } break; case IDC_BWCTL: switch (IsDlgButtonChecked(hWnd, IDC_BWCTL)) { case BST_CHECKED: EnableWindow(GetDlgItem(hWnd, IDC_BANDWIDTH), TRUE); //SetDlgItemText(hWnd, IDC_BANDWIDTH, "0"); break; case BST_UNCHECKED: EnableWindow(GetDlgItem(hWnd, IDC_BANDWIDTH), FALSE); //SetDlgItemText(hWnd, IDC_BANDWIDTH, ""); break; } break; } break; } return FALSE; } int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { hInstance = hInst; return DialogBox(hInstance, MAKEINTRESOURCE (IDD_MAINDIALOG), NULL, (DLGPROC) DialogProc); } faac-1.28/frontend/resource.h0000644010307701030770000000234307640630340017667 0ustar fabian-guestfabian-guest//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by faacgui.rc // #define IDD_MAINDIALOG 102 #define IDC_INPUTFILENAME 1000 #define IDC_SELECT_INPUTFILE 1001 #define IDC_OUTPUTFILENAME 1002 #define IDC_SELECT_OUTPUTFILE 1003 #define IDC_INPUTPARAMS 1004 #define IDC_PROGRESS 1006 #define IDC_ALLOWMIDSIDE 1007 #define IDC_TIME 1008 #define IDC_BANDWIDTH 1009 #define IDC_QUALITY 1010 #define IDC_USERAW 1011 #define IDC_USETNS 1012 #define IDC_USELFE2 1013 #define IDC_USELFE 1013 #define IDC_BWCTL 1014 #define IDC_COMPILEDATE 1018 #define IDC_MPEGVERSION 1020 #define IDC_OBJECTTYPE 1021 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 104 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1022 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif faac-1.28/include/0000755010307701030770000000000011144236255015472 5ustar fabian-guestfabian-guestfaac-1.28/include/Makefile.in0000644010307701030770000002624411144236255017547 0ustar fabian-guestfabian-guest# 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 = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/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)$(includedir)" includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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@ include_HEADERS = faac.h faaccfg.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) --gnu include/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu 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 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$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)$(includedir)"; 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-includeHEADERS 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-includeHEADERS 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-am install-data \ install-data-am install-exec install-exec-am \ install-includeHEADERS 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-am uninstall-includeHEADERS \ 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: faac-1.28/include/Makefile.am0000644010307701030770000000004307737533471017540 0ustar fabian-guestfabian-guestinclude_HEADERS = faac.h faaccfg.h faac-1.28/include/faac.h0000644010307701030770000000447311137132170016536 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: faac.h,v 1.36 2009/01/25 18:50:32 menno Exp $ */ #ifndef _FAAC_H_ #define _FAAC_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if defined(_WIN32) && !defined(__MINGW32__) # ifndef FAACAPI # define FAACAPI __stdcall # endif #else # ifndef FAACAPI # define FAACAPI # endif #endif #pragma pack(push, 1) typedef struct { void *ptr; char *name; } psymodellist_t; #include "faaccfg.h" typedef void *faacEncHandle; #ifndef HAVE_INT32_T typedef signed int int32_t; #endif /* Allows an application to get FAAC version info. This is intended purely for informative purposes. Returns FAAC_CFG_VERSION. */ int FAACAPI faacEncGetVersion(char **faac_id_string, char **faac_copyright_string); faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder); int FAACAPI faacEncSetConfiguration(faacEncHandle hEncoder, faacEncConfigurationPtr config); faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate, unsigned int numChannels, unsigned long *inputSamples, unsigned long *maxOutputBytes); int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder, unsigned char **ppBuffer, unsigned long *pSizeOfDecoderSpecificInfo); int FAACAPI faacEncEncode(faacEncHandle hEncoder, int32_t * inputBuffer, unsigned int samplesInput, unsigned char *outputBuffer, unsigned int bufferSize); int FAACAPI faacEncClose(faacEncHandle hEncoder); #pragma pack(pop) #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _FAAC_H_ */ faac-1.28/include/faaccfg.h0000644010307701030770000000576310071772025017226 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: faaccfg.h,v 1.3 2004/07/04 12:12:05 corrados Exp $ */ #ifndef _FAACCFG_H_ #define _FAACCFG_H_ #define FAAC_CFG_VERSION 104 /* MPEG ID's */ #define MPEG2 1 #define MPEG4 0 /* AAC object types */ #define MAIN 1 #define LOW 2 #define SSR 3 #define LTP 4 /* Input Formats */ #define FAAC_INPUT_NULL 0 #define FAAC_INPUT_16BIT 1 #define FAAC_INPUT_24BIT 2 #define FAAC_INPUT_32BIT 3 #define FAAC_INPUT_FLOAT 4 #define SHORTCTL_NORMAL 0 #define SHORTCTL_NOSHORT 1 #define SHORTCTL_NOLONG 2 #pragma pack(push, 1) typedef struct faacEncConfiguration { /* config version */ int version; /* library version */ char *name; /* copyright string */ char *copyright; /* MPEG version, 2 or 4 */ unsigned int mpegVersion; /* AAC object type */ unsigned int aacObjectType; /* Allow mid/side coding */ unsigned int allowMidside; /* Use one of the channels as LFE channel */ unsigned int useLfe; /* Use Temporal Noise Shaping */ unsigned int useTns; /* bitrate / channel of AAC file */ unsigned long bitRate; /* AAC file frequency bandwidth */ unsigned int bandWidth; /* Quantizer quality */ unsigned long quantqual; /* Bitstream output format (0 = Raw; 1 = ADTS) */ unsigned int outputFormat; /* psychoacoustic model list */ psymodellist_t *psymodellist; /* selected index in psymodellist */ unsigned int psymodelidx; /* PCM Sample Input Format 0 FAAC_INPUT_NULL invalid, signifies a misconfigured config 1 FAAC_INPUT_16BIT native endian 16bit 2 FAAC_INPUT_24BIT native endian 24bit in 24 bits (not implemented) 3 FAAC_INPUT_32BIT native endian 24bit in 32 bits (DEFAULT) 4 FAAC_INPUT_FLOAT 32bit floating point */ unsigned int inputFormat; /* block type enforcing (SHORTCTL_NORMAL/SHORTCTL_NOSHORT/SHORTCTL_NOLONG) */ int shortctl; /* Channel Remapping Default 0, 1, 2, 3 ... 63 (64 is MAX_CHANNELS in coder.h) WAVE 4.0 2, 0, 1, 3 WAVE 5.0 2, 0, 1, 3, 4 WAVE 5.1 2, 0, 1, 4, 5, 3 AIFF 5.1 2, 0, 3, 1, 4, 5 */ int channel_map[64]; } faacEncConfiguration, *faacEncConfigurationPtr; #pragma pack(pop) #endif /* _FAACCFG_H_ */ faac-1.28/libfaac/0000755010307701030770000000000011144236255015430 5ustar fabian-guestfabian-guestfaac-1.28/libfaac/kiss_fft/0000755010307701030770000000000011144236236017237 5ustar fabian-guestfabian-guestfaac-1.28/libfaac/kiss_fft/CHANGELOG0000644010307701030770000000417710200706510020447 0ustar fabian-guestfabian-guest1.2.1 (April 4, 2004) compiles cleanly with just about every -W warning flag under the sun reorganized kiss_fft_state so it could be read-only/const. This may be useful for embedded systems that are willing to predeclare twiddle factors, factorization. Fixed C_MUL,S_MUL on 16-bit platforms. tmpbuf will only be allocated if input & output buffers are same scratchbuf will only be allocated for ffts that are not multiples of 2,3,5 NOTE: The tmpbuf,scratchbuf changes may require synchronization code for multi-threaded apps. 1.2 (Feb 23, 2004) interface change -- cfg object is forward declaration of struct instead of void* This maintains type saftey and lets the compiler warn/error about stupid mistakes. (prompted by suggestion from Erik de Castro Lopo) small speed improvements added psdpng.c -- sample utility that will create png spectrum "waterfalls" from an input file ( not terribly useful yet) 1.1.1 (Feb 1, 2004 ) minor bug fix -- only affects odd rank, in-place, multi-dimensional FFTs 1.1 : (Jan 30,2004) split sample_code/ into test/ and tools/ Removed 2-D fft and added N-D fft (arbitrary) modified fftutil.c to allow multi-d FFTs Modified core fft routine to allow an input stride via kiss_fft_stride() (eased support of multi-D ffts) Added fast convolution filtering (FIR filtering using overlap-scrap method, with tail scrap) Add kfc.[ch]: the KISS FFT Cache. It takes care of allocs for you ( suggested by Oscar Lesta ). 1.0.1 (Dec 15, 2003) fixed bug that occurred when nfft==1 1.0 : (Dec 14, 2003) changed kiss_fft function from using a single buffer, to two buffers. If the same buffer pointer is supplied for both in and out, kiss will manage the buffer copies. added kiss_fft2d and kiss_fftr as separate source files (declarations in kiss_fft.h ) 0.4 :(Nov 4,2003) optimized for radix 2,3,4,5 0.3 :(Oct 28, 2003) woops, version 2 didn't actually factor out any radices other than 2 0.2 :(Oct 27, 2003) added mixed radix, only radix 2,4 optimized versions 0.1 :(May 19 2003) initial release, radix 2 only faac-1.28/libfaac/kiss_fft/COPYING0000644010307701030770000000270310200706510020261 0ustar fabian-guestfabian-guestCopyright (c) 2003-2004 Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. faac-1.28/libfaac/kiss_fft/README0000644010307701030770000001035410200706510020107 0ustar fabian-guestfabian-guestKISS FFT - A mixed-radix Fast Fourier Transform based up on the principle, "Keep It Simple, Stupid." There are many great fft libraries already around. Kiss FFT is not trying to be better than any of them. It only attempts to be a reasonably efficient, moderately useful FFT that can use fixed or floating data types and can be incorporated into someone's C program in a few minutes with trivial licensing. USAGE: The basic usage for 1-d complex FFT is: #include "kiss_fft.h" kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,inverse_fft ); while ... ... // put kth sample in cx_in[k].r and cx_in[k].i kiss_fft( cfg , cx_in , cx_out ); ... // transformed. DC is in cx_out[0].r and cx_out[0].i free(cfg); Note: frequency-domain data is stored from dc up to 2pi. so cx_out[0] is the dc bin of the FFT and cx_out[nfft/2] is the Nyquist bin (if exists) Declarations are in "kiss_fft.h", along with a brief description of the functions you'll need to use. Code definitions for 1d complex FFTs are in kiss_fft.c. You can do other cool stuff with the extras you'll find in tools/ * arbitrary dimension complex FFTs * 1-d real FFTs * fast convolution FIR filtering * spectrum image creation The core fft and most tools/ code can be compiled to use float, double or Q15 short samples. The default is float. BACKGROUND: I started coding this because I couldn't find a fixed point FFT that didn't use assembly code. I started with floating point numbers so I could get the theory straight before working on fixed point issues. In the end, I had a little bit of code that could be recompiled easily to do ffts with short, float or double (other types should be easy too). Once I got my FFT working, I was curious about the speed compared to a well respected and highly optimized fft library. I don't want to criticize this great library, so let's call it FFT_BRANDX. During this process, I learned: 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d). 2. It took me an embarrassingly long time to get FFT_BRANDX working. 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB. 4. FFT_BRANDX is roughly twice as fast as KISS FFT. It is wonderful that free, highly optimized libraries like FFT_BRANDX exist. But such libraries carry a huge burden of complexity necessary to extract every last bit of performance. Sometimes simpler is better, even if it's not better. PERFORMANCE: (on Athlon XP 2100+, with gcc 2.96, float data type) Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time. For comparison, it took md5sum twice as long to process the same amount of data. Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024). DO NOT: ... use Kiss if you need the Fastest Fourier Transform in the World ... ask me to add features that will bloat the code UNDER THE HOOD: Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. No scaling is done. Optimized butterflies are used for factors 2,3,4, and 5. The real optimization code only works for even length ffts. It does two half-length FFTs in parallel (packed into real&imag), and then combines them via twiddling. The fast convolution filtering uses the overlap-scrap method, slightly modified to put the scrap at the tail. LICENSE: BSD, see COPYING for details. Basically, "free to use&change, give credit where due, no guarantees" TODO: *) Add real optimization for odd length FFTs (DST?) *) Add real optimization to the n-dimensional FFT *) Add simple windowing function, e.g. Hamming : w(i)=.54-.46*cos(2pi*i/(n-1)) *) Make the fixed point scaling and bit shifts more easily configurable. *) Document/revisit the input/output fft scaling *) See if the fixed point code can be optimized a little without adding complexity. *) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c *) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others) AUTHOR: Mark Borgerding Mark@Borgerding.net faac-1.28/libfaac/kiss_fft/README.kiss_fft0000644010307701030770000000021510200706510021711 0ustar fabian-guestfabian-guestSee README and COPYING files for author and copyright information. kiss_fft.c is modified in order to eliminate static variables. -- sur. faac-1.28/libfaac/kiss_fft/TIPS0000644010307701030770000000214710200706510017732 0ustar fabian-guestfabian-guestSpeed: * experiment with compiler flags Special thanks to Oscar Lesta. He suggested some compiler flags for gcc that make a big difference. They shave 10-15% off execution time on some systems. Try some combination of: -march=pentiumpro -ffast-math -fomit-frame-pointer * If the input data has no imaginary component, use the kiss_fftr code under tools/. Real ffts are roughly twice as fast as complex. Reducing code size: * remove some of the butterflies. There are currently butterflies optimized for radices 2,3,4,5. It is worth mentioning that you can still use FFT sizes that contain these factors, they just won't be quite as fast. You can decide for yourself whether to keep radix 2 or 4. If you do some work in this area, let me know what you find. * For platforms where ROM/code space is more plentiful than RAM, consider creating a hardcoded kiss_fft_state. In other words, decide which FFT size(s) you want and make a structure with the correct factors and twiddles. faac-1.28/libfaac/kiss_fft/_kiss_fft_guts.h0000644010307701030770000000732410200706510022414 0ustar fabian-guestfabian-guest/* Copyright (c) 2003-2004, Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* kiss_fft.h defines kiss_fft_scalar as either short or a float type and defines typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ #include "kiss_fft.h" #define MAXFACTORS 32 /* e.g. an fft of length 128 has 4 factors as far as kissfft is concerned 4*4*4*2 */ struct kiss_fft_state{ int nfft; int inverse; int factors[2*MAXFACTORS]; kiss_fft_cpx twiddles[1]; }; /* Explanation of macros dealing with complex math: C_MUL(m,a,b) : m = a*b C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise C_SUB( res, a,b) : res = a - b C_SUBFROM( res , a) : res -= a C_ADDTO( res , a) : res += a * */ #ifdef FIXED_POINT # define smul(a,b) ( (long)(a)*(b) ) # define sround( x ) (short)( ( (x) + (1<<14) ) >>15 ) # define S_MUL(a,b) sround( smul(a,b) ) # define C_MUL(m,a,b) \ do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) # define C_FIXDIV(c,div) \ do{ (c).r /= div; (c).i /=div; }while(0) # define C_MULBYSCALAR( c, s ) \ do{ (c).r = sround( smul( (c).r , s ) ) ;\ (c).i = sround( smul( (c).i , s ) ) ; }while(0) #else /* not FIXED_POINT*/ # define S_MUL(a,b) ( (a)*(b) ) #define C_MUL(m,a,b) \ do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) # define C_FIXDIV(c,div) /* NOOP */ # define C_MULBYSCALAR( c, s ) \ do{ (c).r *= (s);\ (c).i *= (s); }while(0) #endif #define C_ADD( res, a,b)\ do { (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; }while(0) #define C_SUB( res, a,b)\ do { (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; }while(0) #define C_ADDTO( res , a)\ do { (res).r += (a).r; (res).i += (a).i; }while(0) #define C_SUBFROM( res , a)\ do { (res).r -= (a).r; (res).i -= (a).i; }while(0) static void kf_cexp(kiss_fft_cpx * x,double phase) /* returns e ** (j*phase) */ { #ifdef FIXED_POINT x->r = (kiss_fft_scalar) (32767 * cos (phase)); x->i = (kiss_fft_scalar) (32767 * sin (phase)); #else x->r = cos (phase); x->i = sin (phase); #endif } /* a debugging function */ #define pcpx(c)\ fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) faac-1.28/libfaac/kiss_fft/kiss_fft.c0000644010307701030770000002560510200706510021210 0ustar fabian-guestfabian-guest/* Copyright (c) 2003-2004, Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "_kiss_fft_guts.h" /* The guts header contains all the multiplication and addition macros that are defined for fixed or floating point complex numbers. It also delares the kf_ internal functions. */ static void kf_bfly2( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m ) { kiss_fft_cpx * Fout2; kiss_fft_cpx * tw1 = st->twiddles; kiss_fft_cpx t; Fout2 = Fout + m; do{ C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); C_MUL (t, *Fout2 , *tw1); tw1 += fstride; C_SUB( *Fout2 , *Fout , t ); C_ADDTO( *Fout , t ); ++Fout2; ++Fout; }while (--m); } static void kf_bfly4( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, const size_t m ) { kiss_fft_cpx *tw1,*tw2,*tw3; kiss_fft_cpx scratch[6]; size_t k=m; const size_t m2=2*m; const size_t m3=3*m; tw3 = tw2 = tw1 = st->twiddles; do { C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); C_MUL(scratch[0],Fout[m] , *tw1 ); C_MUL(scratch[1],Fout[m2] , *tw2 ); C_MUL(scratch[2],Fout[m3] , *tw3 ); C_SUB( scratch[5] , *Fout, scratch[1] ); C_ADDTO(*Fout, scratch[1]); C_ADD( scratch[3] , scratch[0] , scratch[2] ); C_SUB( scratch[4] , scratch[0] , scratch[2] ); C_SUB( Fout[m2], *Fout, scratch[3] ); tw1 += fstride; tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); if(st->inverse) { Fout[m].r = scratch[5].r - scratch[4].i; Fout[m].i = scratch[5].i + scratch[4].r; Fout[m3].r = scratch[5].r + scratch[4].i; Fout[m3].i = scratch[5].i - scratch[4].r; }else{ Fout[m].r = scratch[5].r + scratch[4].i; Fout[m].i = scratch[5].i - scratch[4].r; Fout[m3].r = scratch[5].r - scratch[4].i; Fout[m3].i = scratch[5].i + scratch[4].r; } ++Fout; }while(--k); } static void kf_bfly3( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, size_t m ) { size_t k=m; const size_t m2 = 2*m; kiss_fft_cpx *tw1,*tw2; kiss_fft_cpx scratch[5]; kiss_fft_cpx epi3; epi3 = st->twiddles[fstride*m]; tw1=tw2=st->twiddles; do{ C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); C_MUL(scratch[1],Fout[m] , *tw1); C_MUL(scratch[2],Fout[m2] , *tw2); C_ADD(scratch[3],scratch[1],scratch[2]); C_SUB(scratch[0],scratch[1],scratch[2]); tw1 += fstride; tw2 += fstride*2; Fout[m].r = Fout->r - scratch[3].r/2; Fout[m].i = Fout->i - scratch[3].i/2; C_MULBYSCALAR( scratch[0] , epi3.i ); C_ADDTO(*Fout,scratch[3]); Fout[m2].r = Fout[m].r + scratch[0].i; Fout[m2].i = Fout[m].i - scratch[0].r; Fout[m].r -= scratch[0].i; Fout[m].i += scratch[0].r; ++Fout; }while(--k); } static void kf_bfly5( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m ) { kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; int u; kiss_fft_cpx scratch[13]; kiss_fft_cpx * twiddles = st->twiddles; kiss_fft_cpx *tw; kiss_fft_cpx ya,yb; ya = twiddles[fstride*m]; yb = twiddles[fstride*2*m]; Fout0=Fout; Fout1=Fout0+m; Fout2=Fout0+2*m; Fout3=Fout0+3*m; Fout4=Fout0+4*m; tw=st->twiddles; for ( u=0; ur += scratch[7].r + scratch[8].r; Fout0->i += scratch[7].i + scratch[8].i; scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); C_SUB(*Fout1,scratch[5],scratch[6]); C_ADD(*Fout4,scratch[5],scratch[6]); scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); C_ADD(*Fout2,scratch[11],scratch[12]); C_SUB(*Fout3,scratch[11],scratch[12]); ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; } } /* perform the butterfly for one stage of a mixed radix FFT */ static void kf_bfly_generic( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m, int p ) { int u,k,q1,q; kiss_fft_cpx * twiddles = st->twiddles; kiss_fft_cpx t; int Norig = st->nfft; kiss_fft_cpx *scratchbuf=(kiss_fft_cpx *)malloc( sizeof(kiss_fft_cpx) * p ); for ( u=0; u=Norig) twidx-=Norig; C_MUL(t,scratchbuf[q] , twiddles[twidx] ); C_ADDTO( Fout[ k ] ,t); } k += m; } } free( scratchbuf ); } static void kf_work( kiss_fft_cpx * Fout, const kiss_fft_cpx * f, const size_t fstride, int in_stride, int * factors, const kiss_fft_cfg st ) { kiss_fft_cpx * Fout_beg=Fout; const int p=*factors++; /* the radix */ const int m=*factors++; /* stage's fft length/p */ const kiss_fft_cpx * Fout_end = Fout + p*m; if (m==1) { do{ *Fout = *f; f += fstride*in_stride; }while(++Fout != Fout_end ); }else{ do{ kf_work( Fout , f, fstride*p, in_stride, factors,st); f += fstride*in_stride; }while( (Fout += m) != Fout_end ); } Fout=Fout_beg; switch (p) { case 2: kf_bfly2(Fout,fstride,st,m); break; case 3: kf_bfly3(Fout,fstride,st,m); break; case 4: kf_bfly4(Fout,fstride,st,m); break; case 5: kf_bfly5(Fout,fstride,st,m); break; default: kf_bfly_generic(Fout,fstride,st,m,p); break; } } /* facbuf is populated by p1,m1,p2,m2, ... where p[i] * m[i] = m[i-1] m0 = n */ static void kf_factor(int n,int * facbuf) { int p=4; double floor_sqrt; floor_sqrt = floor( sqrt((double)n) ); /*factor out powers of 4, powers of 2, then any remaining primes */ do { while (n % p) { switch (p) { case 4: p = 2; break; case 2: p = 3; break; default: p += 2; break; } if (p > floor_sqrt) p = n; /* no more factors, skip to end */ } n /= p; *facbuf++ = p; *facbuf++ = n; } while (n > 1); } /* * * User-callable function to allocate all necessary storage space for the fft. * * The return value is a contiguous block of memory, allocated with malloc. As such, * It can be freed with free(), rather than a kiss_fft-specific function. * */ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) { kiss_fft_cfg st=NULL; size_t memneeded = sizeof(struct kiss_fft_state) + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ if ( lenmem==NULL ) { st = ( kiss_fft_cfg)malloc( memneeded ); }else{ if (*lenmem >= memneeded) st = (kiss_fft_cfg)mem; *lenmem = memneeded; } if (st) { int i; const double pi=3.14159265358979323846264338327; const double phase0 = -2.0 * pi / (double)( nfft ); st->nfft=nfft; st->inverse = inverse_fft; for (i=0;iinverse) phase *= -1; kf_cexp(st->twiddles+i, phase ); } kf_factor(nfft,st->factors); } return st; } void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) { if (fin == fout) { kiss_fft_cpx *tmpbuf=(kiss_fft_cpx*)malloc( sizeof(kiss_fft_cpx) * st->nfft ); kf_work(tmpbuf,fin,1,in_stride, st->factors,st); memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); free( tmpbuf ); }else{ kf_work( fout, fin, 1,in_stride, st->factors,st ); } } void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) { kiss_fft_stride(cfg,fin,fout,1); } faac-1.28/libfaac/kiss_fft/kiss_fft.h0000644010307701030770000000440210200706510021205 0ustar fabian-guestfabian-guest#ifndef KISS_FFT_H #define KISS_FFT_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* ATTENTION! If you would like a : -- a utility that will handle the caching of fft objects -- real-only FFT -- a multi-dimensional FFT -- a command-line utility to perform ffts -- a command-line utility to perform fast-convolution filtering then see tools/ */ #ifdef FIXED_POINT # define kiss_fft_scalar short #else # ifndef kiss_fft_scalar /* default is float */ # define kiss_fft_scalar float # endif #endif typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; typedef struct kiss_fft_state* kiss_fft_cfg; /* * kiss_fft_alloc * * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. * * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); * * The return value from fft_alloc is a cfg buffer used internally * by the fft routine or NULL. * * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. * The returned value should be free()d when done to avoid memory leaks. * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, * then the function places the cfg in mem and the size used in *lenmem * and returns mem. * * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), * then the function returns NULL and places the minimum cfg * buffer size in *lenmem. * */ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); /* * kiss_fft(cfg,in_out_buf) * * Perform an FFT on a complex input buffer. * for a forward FFT, * fin should be f[0] , f[1] , ... ,f[nfft-1] * fout will be F[0] , F[1] , ... ,F[nfft-1] * Note that each element is complex and can be accessed like f[k].r and f[k].i * */ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); /* If kiss_fft_alloc allocated a buffer, it is one contiguous buffer and can be simply free()d when no longer needed*/ #define kiss_fft_free free #ifdef __cplusplus } #endif #endif faac-1.28/libfaac/kiss_fft/kiss_fftr.c0000644010307701030770000001161510200706510021366 0ustar fabian-guestfabian-guest/* Copyright (c) 2003-2004, Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "kiss_fftr.h" #include "_kiss_fft_guts.h" struct kiss_fftr_state{ kiss_fft_cfg substate; kiss_fft_cpx * tmpbuf; kiss_fft_cpx * super_twiddles; }; kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) { int i; kiss_fftr_cfg st = NULL; size_t subsize, memneeded; if (nfft & 1) { fprintf(stderr,"Real FFT optimization must be even.\n"); return NULL; } nfft >>= 1; kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize); memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 2); if (lenmem == NULL) { st = (kiss_fftr_cfg) malloc (memneeded); } else { if (*lenmem >= memneeded) st = (kiss_fftr_cfg) mem; *lenmem = memneeded; } if (!st) return NULL; st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */ st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize); st->super_twiddles = st->tmpbuf + nfft; kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize); for (i = 0; i < nfft; ++i) { double phase = -3.14159265358979323846264338327 * ((double) i / nfft + .5); if (inverse_fft) phase *= -1; kf_cexp (st->super_twiddles+i,phase); } return st; } void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata) { /* input buffer timedata is stored row-wise */ int k,N; if ( st->substate->inverse) { fprintf(stderr,"kiss fft usage error: improper alloc\n"); exit(1); } N = st->substate->nfft; /*perform the parallel fft of two real signals packed in real,imag*/ kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf ); freqdata[0].r = st->tmpbuf[0].r + st->tmpbuf[0].i; freqdata[0].i = 0; C_FIXDIV(freqdata[0],2); for (k=1;k <= N/2 ; ++k ) { kiss_fft_cpx fpnk,fpk,f1k,f2k,tw; fpk = st->tmpbuf[k]; fpnk.r = st->tmpbuf[N-k].r; fpnk.i = -st->tmpbuf[N-k].i; C_FIXDIV(fpk,2); C_FIXDIV(fpnk,2); C_ADD( f1k, fpk , fpnk ); C_SUB( f2k, fpk , fpnk ); C_MUL( tw , f2k , st->super_twiddles[k]); C_ADD( freqdata[k] , f1k ,tw); freqdata[k].r = (f1k.r + tw.r) / 2; freqdata[k].i = (f1k.i + tw.i) / 2; freqdata[N-k].r = (f1k.r - tw.r)/2; freqdata[N-k].i = - (f1k.i - tw.i)/2; } freqdata[N].r = st->tmpbuf[0].r - st->tmpbuf[0].i; freqdata[N].i = 0; C_FIXDIV(freqdata[N],2); } void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata) { /* input buffer timedata is stored row-wise */ int k, N; if (st->substate->inverse == 0) { fprintf (stderr, "kiss fft usage error: improper alloc\n"); exit (1); } N = st->substate->nfft; st->tmpbuf[0].r = freqdata[0].r + freqdata[N].r; st->tmpbuf[0].i = freqdata[0].r - freqdata[N].r; for (k = 1; k <= N / 2; ++k) { kiss_fft_cpx fk, fnkc, fek, fok, tmpbuf; fk = freqdata[k]; fnkc.r = freqdata[N - k].r; fnkc.i = -freqdata[N - k].i; C_ADD (fek, fk, fnkc); C_SUB (tmpbuf, fk, fnkc); C_MUL (fok, tmpbuf, st->super_twiddles[k]); C_ADD (st->tmpbuf[k], fek, fok); C_SUB (st->tmpbuf[N - k], fek, fok); st->tmpbuf[N - k].i *= -1; } kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata); } faac-1.28/libfaac/kiss_fft/kiss_fftr.h0000644010307701030770000000153210200706510021370 0ustar fabian-guestfabian-guest#ifndef KISS_FTR_H #define KISS_FTR_H #include "kiss_fft.h" #ifdef __cplusplus extern "C" { #endif /* Real optimized version can save about 45% cpu time vs. complex fft of a real seq. */ typedef struct kiss_fftr_state *kiss_fftr_cfg; kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem); /* nfft must be even If you don't care to allocate space, use mem = lenmem = NULL */ void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); /* input timedata has nfft scalar points output freqdata has nfft/2+1 complex points */ void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); /* input freqdata has nfft/2+1 complex points output timedata has nfft scalar points */ #define kiss_fftr_free free #ifdef __cplusplus } #endif #endif faac-1.28/libfaac/Makefile.in0000644010307701030770000004320211144236255017476 0ustar fabian-guestfabian-guest# 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 = libfaac DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/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)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libfaac_la_DEPENDENCIES = am__libfaac_la_SOURCES_DIST = aacquant.c bitstream.c fft.c frame.c \ midside.c psychkni.c util.c backpred.c channels.c filtbank.c \ huffman.c ltp.c tns.c kiss_fft/kiss_fftr.c kiss_fft/kiss_fft.c am__objects_1 = aacquant.lo bitstream.lo fft.lo frame.lo midside.lo \ psychkni.lo util.lo backpred.lo channels.lo filtbank.lo \ huffman.lo ltp.lo tns.lo @USE_DRM_TRUE@am__objects_2 = kiss_fftr.lo kiss_fft.lo am_libfaac_la_OBJECTS = $(am__objects_1) $(am__objects_2) libfaac_la_OBJECTS = $(am_libfaac_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) 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 = $(libfaac_la_SOURCES) DIST_SOURCES = $(am__libfaac_la_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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@ lib_LTLIBRARIES = libfaac.la main_SOURCES = aacquant.c bitstream.c fft.c frame.c midside.c psychkni.c util.c backpred.c channels.c filtbank.c huffman.c ltp.c tns.c @USE_DRM_TRUE@drm_SOURCES = kiss_fft/kiss_fftr.c kiss_fft/kiss_fft.c libfaac_la_SOURCES = $(main_SOURCES) $(drm_SOURCES) libfaac_la_INCLUDES = aacquant.h channels.h filtbank.h hufftab.h psych.h backpred.h coder.h frame.h midside.h tns.h bitstream.h fft.h huffman.h ltp.h util.h libfaac_la_LIBADD = -lm 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) --gnu libfaac/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libfaac/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-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 libfaac.la: $(libfaac_la_OBJECTS) $(libfaac_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libfaac_la_LDFLAGS) $(libfaac_la_OBJECTS) $(libfaac_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aacquant.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backpred.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitstream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtbank.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffman.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kiss_fft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kiss_fftr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midside.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psychkni.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.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 $@ $< kiss_fftr.lo: kiss_fft/kiss_fftr.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kiss_fftr.lo -MD -MP -MF "$(DEPDIR)/kiss_fftr.Tpo" -c -o kiss_fftr.lo `test -f 'kiss_fft/kiss_fftr.c' || echo '$(srcdir)/'`kiss_fft/kiss_fftr.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kiss_fftr.Tpo" "$(DEPDIR)/kiss_fftr.Plo"; else rm -f "$(DEPDIR)/kiss_fftr.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kiss_fft/kiss_fftr.c' object='kiss_fftr.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) $(AM_CFLAGS) $(CFLAGS) -c -o kiss_fftr.lo `test -f 'kiss_fft/kiss_fftr.c' || echo '$(srcdir)/'`kiss_fft/kiss_fftr.c kiss_fft.lo: kiss_fft/kiss_fft.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kiss_fft.lo -MD -MP -MF "$(DEPDIR)/kiss_fft.Tpo" -c -o kiss_fft.lo `test -f 'kiss_fft/kiss_fft.c' || echo '$(srcdir)/'`kiss_fft/kiss_fft.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/kiss_fft.Tpo" "$(DEPDIR)/kiss_fft.Plo"; else rm -f "$(DEPDIR)/kiss_fft.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kiss_fft/kiss_fft.c' object='kiss_fft.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) $(AM_CFLAGS) $(CFLAGS) -c -o kiss_fft.lo `test -f 'kiss_fft/kiss_fft.c' || echo '$(srcdir)/'`kiss_fft/kiss_fft.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) installdirs: for dir in "$(DESTDIR)$(libdir)"; 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-libLTLIBRARIES 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-libLTLIBRARIES 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-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES 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-libLTLIBRARIES 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 \ uninstall-libLTLIBRARIES # 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: faac-1.28/libfaac/Makefile.am0000644010307701030770000000077410662353553017501 0ustar fabian-guestfabian-guestlib_LTLIBRARIES = libfaac.la main_SOURCES = aacquant.c bitstream.c fft.c frame.c midside.c psychkni.c util.c backpred.c channels.c filtbank.c huffman.c ltp.c tns.c if USE_DRM drm_SOURCES = kiss_fft/kiss_fftr.c kiss_fft/kiss_fft.c endif libfaac_la_SOURCES = $(main_SOURCES) $(drm_SOURCES) libfaac_la_INCLUDES = aacquant.h channels.h filtbank.h hufftab.h psych.h backpred.h coder.h frame.h midside.h tns.h bitstream.h fft.h huffman.h ltp.h util.h libfaac_la_LIBADD = -lm INCLUDES = -I$(top_srcdir)/include faac-1.28/libfaac/aacquant.c0000644010307701030770000004337610771560411017405 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * Copyright (C) 2002, 2003 Krzysztof Nikiel * * 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 * * $Id: aacquant.c,v 1.32 2008/03/23 23:00:25 menno Exp $ */ #include #include #include "frame.h" #include "aacquant.h" #include "coder.h" #include "huffman.h" #include "psych.h" #include "util.h" #define TAKEHIRO_IEEE754_HACK 1 #define XRPOW_FTOI(src,dest) ((dest) = (int)(src)) #define QUANTFAC(rx) adj43[rx] #define ROUNDFAC 0.4054 static int FixNoise(CoderInfo *coderInfo, const double *xr, double *xr_pow, int *xi, double *xmin, double *pow43, double *adj43); static void CalcAllowedDist(CoderInfo *coderInfo, PsyInfo *psyInfo, double *xr, double *xmin, int quality); void AACQuantizeInit(CoderInfo *coderInfo, unsigned int numChannels, AACQuantCfg *aacquantCfg) { unsigned int channel, i; aacquantCfg->pow43 = (double*)AllocMemory(PRECALC_SIZE*sizeof(double)); aacquantCfg->adj43 = (double*)AllocMemory(PRECALC_SIZE*sizeof(double)); aacquantCfg->pow43[0] = 0.0; for(i=1;ipow43[i] = pow((double)i, 4.0/3.0); #if TAKEHIRO_IEEE754_HACK aacquantCfg->adj43[0] = 0.0; for (i = 1; i < PRECALC_SIZE; i++) aacquantCfg->adj43[i] = i - 0.5 - pow(0.5 * (aacquantCfg->pow43[i - 1] + aacquantCfg->pow43[i]),0.75); #else // !TAKEHIRO_IEEE754_HACK for (i = 0; i < PRECALC_SIZE-1; i++) aacquantCfg->adj43[i] = (i + 1) - pow(0.5 * (aacquantCfg->pow43[i] + aacquantCfg->pow43[i + 1]), 0.75); aacquantCfg->adj43[i] = 0.5; #endif for (channel = 0; channel < numChannels; channel++) { coderInfo[channel].requantFreq = (double*)AllocMemory(BLOCK_LEN_LONG*sizeof(double)); } } void AACQuantizeEnd(CoderInfo *coderInfo, unsigned int numChannels, AACQuantCfg *aacquantCfg) { unsigned int channel; if (aacquantCfg->pow43) { FreeMemory(aacquantCfg->pow43); aacquantCfg->pow43 = NULL; } if (aacquantCfg->adj43) { FreeMemory(aacquantCfg->adj43); aacquantCfg->adj43 = NULL; } for (channel = 0; channel < numChannels; channel++) { if (coderInfo[channel].requantFreq) FreeMemory(coderInfo[channel].requantFreq); } } static void BalanceEnergy(CoderInfo *coderInfo, const double *xr, const int *xi, double *pow43) { const double ifqstep = pow(2.0, 0.25); const double logstep_1 = 1.0 / log(ifqstep); int sb; int nsfb = coderInfo->nr_of_sfb; int start, end; int l; double en0, enq; int shift; for (sb = 0; sb < nsfb; sb++) { double qfac_1; start = coderInfo->sfb_offset[sb]; end = coderInfo->sfb_offset[sb+1]; qfac_1 = pow(2.0, -0.25*(coderInfo->scale_factor[sb] - coderInfo->global_gain)); en0 = 0.0; enq = 0.0; for (l = start; l < end; l++) { double xq; if (!sb && !xi[l]) continue; xq = pow43[xi[l]]; en0 += xr[l] * xr[l]; enq += xq * xq; } if (enq == 0.0) continue; enq *= qfac_1 * qfac_1; shift = (int)(log(sqrt(enq / en0)) * logstep_1 + 1000.5); shift -= 1000; shift += coderInfo->scale_factor[sb]; coderInfo->scale_factor[sb] = shift; } } static void UpdateRequant(CoderInfo *coderInfo, int *xi, double *pow43) { double *requant_xr = coderInfo->requantFreq; int sb; int i; for (sb = 0; sb < coderInfo->nr_of_sfb; sb++) { double invQuantFac = pow(2.0, -0.25*(coderInfo->scale_factor[sb] - coderInfo->global_gain)); int start = coderInfo->sfb_offset[sb]; int end = coderInfo->sfb_offset[sb + 1]; for (i = start; i < end; i++) requant_xr[i] = pow43[xi[i]] * invQuantFac; } } int AACQuantize(CoderInfo *coderInfo, PsyInfo *psyInfo, ChannelInfo *channelInfo, int *cb_width, int num_cb, double *xr, AACQuantCfg *aacquantCfg) { int sb, i, do_q = 0; int bits = 0, sign; double xr_pow[FRAME_LEN]; double xmin[MAX_SCFAC_BANDS]; int xi[FRAME_LEN]; /* Use local copy's */ int *scale_factor = coderInfo->scale_factor; /* Set all scalefactors to 0 */ coderInfo->global_gain = 0; for (sb = 0; sb < coderInfo->nr_of_sfb; sb++) scale_factor[sb] = 0; /* Compute xr_pow */ for (i = 0; i < FRAME_LEN; i++) { double temp = fabs(xr[i]); xr_pow[i] = sqrt(temp * sqrt(temp)); do_q += (temp > 1E-20); } if (do_q) { CalcAllowedDist(coderInfo, psyInfo, xr, xmin, aacquantCfg->quality); coderInfo->global_gain = 0; FixNoise(coderInfo, xr, xr_pow, xi, xmin, aacquantCfg->pow43, aacquantCfg->adj43); BalanceEnergy(coderInfo, xr, xi, aacquantCfg->pow43); UpdateRequant(coderInfo, xi, aacquantCfg->pow43); for ( i = 0; i < FRAME_LEN; i++ ) { sign = (xr[i] < 0) ? -1 : 1; xi[i] *= sign; coderInfo->requantFreq[i] *= sign; } } else { coderInfo->global_gain = 0; SetMemory(xi, 0, FRAME_LEN*sizeof(int)); } BitSearch(coderInfo, xi); /* offset the difference of common_scalefac and scalefactors by SF_OFFSET */ for (i = 0; i < coderInfo->nr_of_sfb; i++) { if ((coderInfo->book_vector[i]!=INTENSITY_HCB)&&(coderInfo->book_vector[i]!=INTENSITY_HCB2)) { scale_factor[i] = coderInfo->global_gain - scale_factor[i] + SF_OFFSET; } } coderInfo->global_gain = scale_factor[0]; #if 0 printf("global gain: %d\n", coderInfo->global_gain); for (i = 0; i < coderInfo->nr_of_sfb; i++) printf("sf %d: %d\n", i, coderInfo->scale_factor[i]); #endif // clamp to valid diff range { int previous_scale_factor = coderInfo->global_gain; int previous_is_factor = 0; for (i = 0; i < coderInfo->nr_of_sfb; i++) { if ((coderInfo->book_vector[i]==INTENSITY_HCB) || (coderInfo->book_vector[i]==INTENSITY_HCB2)) { const int diff = scale_factor[i] - previous_is_factor; if (diff < -60) scale_factor[i] = previous_is_factor - 60; else if (diff > 59) scale_factor[i] = previous_is_factor + 59; previous_is_factor = scale_factor[i]; // printf("sf %d: %d diff=%d **\n", i, coderInfo->scale_factor[i], diff); } else if (coderInfo->book_vector[i]) { const int diff = scale_factor[i] - previous_scale_factor; if (diff < -60) scale_factor[i] = previous_scale_factor - 60; else if (diff > 59) scale_factor[i] = previous_scale_factor + 59; previous_scale_factor = scale_factor[i]; // printf("sf %d: %d diff=%d\n", i, coderInfo->scale_factor[i], diff); } } } /* place the codewords and their respective lengths in arrays data[] and len[] respectively */ /* there are 'counter' elements in each array, and these are variable length arrays depending on the input */ #ifdef DRM coderInfo->iLenReordSpData = 0; /* init length of reordered spectral data */ coderInfo->iLenLongestCW = 0; /* init length of longest codeword */ coderInfo->cur_cw = 0; /* init codeword counter */ #endif coderInfo->spectral_count = 0; sb = 0; for(i = 0; i < coderInfo->nr_of_sfb; i++) { OutputBits( coderInfo, #ifdef DRM &coderInfo->book_vector[i], /* needed for VCB11 */ #else coderInfo->book_vector[i], #endif xi, coderInfo->sfb_offset[i], coderInfo->sfb_offset[i+1]-coderInfo->sfb_offset[i]); if (coderInfo->book_vector[i]) sb = i; } // FIXME: Check those max_sfb/nr_of_sfb. Isn't it the same? coderInfo->max_sfb = coderInfo->nr_of_sfb = sb + 1; return bits; } #if TAKEHIRO_IEEE754_HACK typedef union { float f; int i; } fi_union; #define MAGIC_FLOAT (65536*(128)) #define MAGIC_INT 0x4b000000 #if 0 static void Quantize(const double *xp, int *pi, double istep) { int j; fi_union *fi; fi = (fi_union *)pi; for (j = FRAME_LEN/4 - 1; j >= 0; --j) { double x0 = istep * xp[0]; double x1 = istep * xp[1]; double x2 = istep * xp[2]; double x3 = istep * xp[3]; x0 += MAGIC_FLOAT; fi[0].f = x0; x1 += MAGIC_FLOAT; fi[1].f = x1; x2 += MAGIC_FLOAT; fi[2].f = x2; x3 += MAGIC_FLOAT; fi[3].f = x3; fi[0].f = x0 + (adj43asm - MAGIC_INT)[fi[0].i]; fi[1].f = x1 + (adj43asm - MAGIC_INT)[fi[1].i]; fi[2].f = x2 + (adj43asm - MAGIC_INT)[fi[2].i]; fi[3].f = x3 + (adj43asm - MAGIC_INT)[fi[3].i]; fi[0].i -= MAGIC_INT; fi[1].i -= MAGIC_INT; fi[2].i -= MAGIC_INT; fi[3].i -= MAGIC_INT; fi += 4; xp += 4; } } #endif static void QuantizeBand(const double *xp, int *pi, double istep, int offset, int end, double *adj43) { int j; fi_union *fi; fi = (fi_union *)pi; for (j = offset; j < end; j++) { double x0 = istep * xp[j]; x0 += MAGIC_FLOAT; fi[j].f = (float)x0; fi[j].f = x0 + (adj43 - MAGIC_INT)[fi[j].i]; fi[j].i -= MAGIC_INT; } } #else #if 0 static void Quantize(const double *xr, int *ix, double istep) { int j; for (j = FRAME_LEN/8; j > 0; --j) { double x1, x2, x3, x4, x5, x6, x7, x8; int rx1, rx2, rx3, rx4, rx5, rx6, rx7, rx8; x1 = *xr++ * istep; x2 = *xr++ * istep; XRPOW_FTOI(x1, rx1); x3 = *xr++ * istep; XRPOW_FTOI(x2, rx2); x4 = *xr++ * istep; XRPOW_FTOI(x3, rx3); x5 = *xr++ * istep; XRPOW_FTOI(x4, rx4); x6 = *xr++ * istep; XRPOW_FTOI(x5, rx5); x7 = *xr++ * istep; XRPOW_FTOI(x6, rx6); x8 = *xr++ * istep; XRPOW_FTOI(x7, rx7); x1 += QUANTFAC(rx1); XRPOW_FTOI(x8, rx8); x2 += QUANTFAC(rx2); XRPOW_FTOI(x1,*ix++); x3 += QUANTFAC(rx3); XRPOW_FTOI(x2,*ix++); x4 += QUANTFAC(rx4); XRPOW_FTOI(x3,*ix++); x5 += QUANTFAC(rx5); XRPOW_FTOI(x4,*ix++); x6 += QUANTFAC(rx6); XRPOW_FTOI(x5,*ix++); x7 += QUANTFAC(rx7); XRPOW_FTOI(x6,*ix++); x8 += QUANTFAC(rx8); XRPOW_FTOI(x7,*ix++); XRPOW_FTOI(x8,*ix++); } } #endif static void QuantizeBand(const double *xp, int *ix, double istep, int offset, int end, double *adj43) { int j; for (j = offset; j < end; j++) { double x0 = istep * xp[j]; x0 += adj43[(int)x0]; ix[j] = (int)x0; } } #endif static void CalcAllowedDist(CoderInfo *coderInfo, PsyInfo *psyInfo, double *xr, double *xmin, int quality) { int sfb, start, end, l; const double globalthr = 132.0 / (double)quality; int last = coderInfo->lastx; int lastsb = 0; int *cb_offset = coderInfo->sfb_offset; int num_cb = coderInfo->nr_of_sfb; double avgenrg = coderInfo->avgenrg; for (sfb = 0; sfb < num_cb; sfb++) { if (last > cb_offset[sfb]) lastsb = sfb; } for (sfb = 0; sfb < num_cb; sfb++) { double thr, tmp; double enrg = 0.0; start = cb_offset[sfb]; end = cb_offset[sfb + 1]; if (sfb > lastsb) { xmin[sfb] = 0; continue; } if (coderInfo->block_type != ONLY_SHORT_WINDOW) { double enmax = -1.0; double lmax; lmax = start; for (l = start; l < end; l++) { if (enmax < (xr[l] * xr[l])) { enmax = xr[l] * xr[l]; lmax = l; } } start = lmax - 2; end = lmax + 3; if (start < 0) start = 0; if (end > last) end = last; } for (l = start; l < end; l++) { enrg += xr[l]*xr[l]; } thr = enrg/((double)(end-start)*avgenrg); thr = pow(thr, 0.1*(lastsb-sfb)/lastsb + 0.3); tmp = 1.0 - ((double)start / (double)last); tmp = tmp * tmp * tmp + 0.075; thr = 1.0 / (1.4*thr + tmp); xmin[sfb] = ((coderInfo->block_type == ONLY_SHORT_WINDOW) ? 0.65 : 1.12) * globalthr * thr; } } static int FixNoise(CoderInfo *coderInfo, const double *xr, double *xr_pow, int *xi, double *xmin, double *pow43, double *adj43) { int i, sb; int start, end; double diffvol; double tmp; const double ifqstep = pow(2.0, 0.1875); const double log_ifqstep = 1.0 / log(ifqstep); const double maxstep = 0.05; for (sb = 0; sb < coderInfo->nr_of_sfb; sb++) { double sfacfix; double fixstep = 0.25; int sfac; double fac; int dist; double sfacfix0 = 1.0, dist0 = 1e50; double maxx; start = coderInfo->sfb_offset[sb]; end = coderInfo->sfb_offset[sb+1]; if (!xmin[sb]) goto nullsfb; maxx = 0.0; for (i = start; i < end; i++) { if (xr_pow[i] > maxx) maxx = xr_pow[i]; } //printf("band %d: maxx: %f\n", sb, maxx); if (maxx < 10.0) { nullsfb: for (i = start; i < end; i++) xi[i] = 0; coderInfo->scale_factor[sb] = 10; continue; } sfacfix = 1.0 / maxx; sfac = (int)(log(sfacfix) * log_ifqstep - 0.5); for (i = start; i < end; i++) xr_pow[i] *= sfacfix; maxx *= sfacfix; coderInfo->scale_factor[sb] = sfac; QuantizeBand(xr_pow, xi, IPOW20(coderInfo->global_gain), start, end, adj43); //printf("\tsfac: %d\n", sfac); calcdist: diffvol = 0.0; for (i = start; i < end; i++) { tmp = xi[i]; diffvol += tmp * tmp; // ~x^(3/2) } if (diffvol < 1e-6) diffvol = 1e-6; tmp = pow(diffvol / (double)(end - start), -0.666); if (fabs(fixstep) > maxstep) { double dd = 0.5*(tmp / xmin[sb] - 1.0); if (fabs(dd) < fabs(fixstep)) { fixstep = dd; if (fabs(fixstep) < maxstep) fixstep = maxstep * ((fixstep > 0) ? 1 : -1); } } if (fixstep > 0) { if (tmp < dist0) { dist0 = tmp; sfacfix0 = sfacfix; } else { if (fixstep > .1) fixstep = .1; } } else { dist0 = tmp; sfacfix0 = sfacfix; } dist = (tmp > xmin[sb]); fac = 0.0; if (fabs(fixstep) >= maxstep) { if ((dist && (fixstep < 0)) || (!dist && (fixstep > 0))) { fixstep = -0.5 * fixstep; } fac = 1.0 + fixstep; } else if (dist) { fac = 1.0 + fabs(fixstep); } if (fac != 0.0) { if (maxx * fac >= IXMAX_VAL) { // restore best noise fac = sfacfix0 / sfacfix; for (i = start; i < end; i++) xr_pow[i] *= fac; maxx *= fac; sfacfix *= fac; coderInfo->scale_factor[sb] = log(sfacfix) * log_ifqstep - 0.5; QuantizeBand(xr_pow, xi, IPOW20(coderInfo->global_gain), start, end, adj43); continue; } if (coderInfo->scale_factor[sb] < -10) { for (i = start; i < end; i++) xr_pow[i] *= fac; maxx *= fac; sfacfix *= fac; coderInfo->scale_factor[sb] = log(sfacfix) * log_ifqstep - 0.5; QuantizeBand(xr_pow, xi, IPOW20(coderInfo->global_gain), start, end, adj43); goto calcdist; } } } return 0; } int SortForGrouping(CoderInfo* coderInfo, PsyInfo *psyInfo, ChannelInfo *channelInfo, int *sfb_width_table, double *xr) { int i,j,ii; int index = 0; double xr_tmp[FRAME_LEN]; int group_offset=0; int k=0; int windowOffset = 0; /* set up local variables for used quantInfo elements */ int* sfb_offset = coderInfo->sfb_offset; int* nr_of_sfb = &(coderInfo->nr_of_sfb); int* window_group_length; int num_window_groups; *nr_of_sfb = coderInfo->max_sfb; /* Init to max_sfb */ window_group_length = coderInfo->window_group_length; num_window_groups = coderInfo->num_window_groups; /* calc org sfb_offset just for shortblock */ sfb_offset[k]=0; for (k=1 ; k <*nr_of_sfb+1; k++) { sfb_offset[k] = sfb_offset[k-1] + sfb_width_table[k-1]; } /* sort the input spectral coefficients */ index = 0; group_offset=0; for (i=0; i< num_window_groups; i++) { for (k=0; k<*nr_of_sfb; k++) { for (j=0; j < window_group_length[i]; j++) { for (ii=0;ii< sfb_width_table[k];ii++) xr_tmp[index++] = xr[ii+ sfb_offset[k] + BLOCK_LEN_SHORT*j +group_offset]; } } group_offset += BLOCK_LEN_SHORT*window_group_length[i]; } for (k=0; ksfb_offset[coderInfo->nr_of_sfb]; for (l = 0; l < end; l++) { if (xr[l]) { last = l; totenrg += xr[l] * xr[l]; } } last++; coderInfo->lastx = last; coderInfo->avgenrg = totenrg / last; } faac-1.28/libfaac/aacquant.h0000644010307701030770000000401607742302273017402 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: aacquant.h,v 1.9 2003/10/12 16:43:39 knik Exp $ */ #ifndef AACQUANT_H #define AACQUANT_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "coder.h" #include "psych.h" #define IXMAX_VAL 8191 #define PRECALC_SIZE (IXMAX_VAL+2) #define LARGE_BITS 100000 #define SF_OFFSET 100 #define POW20(x) pow(2.0,((double)x)*.25) #define IPOW20(x) pow(2.0,-((double)x)*.1875) #pragma pack(push, 1) typedef struct { double *pow43; double *adj43; double quality; } AACQuantCfg; #pragma pack(pop) void AACQuantizeInit(CoderInfo *coderInfo, unsigned int numChannels, AACQuantCfg *aacquantCfg); void AACQuantizeEnd(CoderInfo *coderInfo, unsigned int numChannels, AACQuantCfg *aacquantCfg); int AACQuantize(CoderInfo *coderInfo, PsyInfo *psyInfo, ChannelInfo *channelInfo, int *cb_width, int num_cb, double *xr, AACQuantCfg *aacquantcfg); int SortForGrouping(CoderInfo* coderInfo, PsyInfo *psyInfo, ChannelInfo *channelInfo, int *sfb_width_table, double *xr); void CalcAvgEnrg(CoderInfo *coderInfo, const double *xr); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* AACQUANT_H */ faac-1.28/libfaac/backpred.c0000644010307701030770000003113107345217747017363 0ustar fabian-guestfabian-guest/********************************************************************** This software module was originally developed by and edited by Nokia in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1997. **********************************************************************/ /* * $Id: backpred.c,v 1.5 2001/09/04 18:39:35 menno Exp $ */ #include #include "frame.h" #include "coder.h" #include "channels.h" #include "backpred.h" void PredInit(faacEncHandle hEncoder) { unsigned int channel; for (channel = 0; channel < hEncoder->numChannels; channel++) { BwpInfo *bwpInfo = &(hEncoder->coderInfo[channel].bwpInfo); bwpInfo->psy_init_mc = 0; bwpInfo->reset_count_mc = 0; } } void PredCalcPrediction(double *act_spec, double *last_spec, int btype, int nsfb, int *isfb_width, CoderInfo *coderInfo, ChannelInfo *channelInfo, int chanNum) { int i, k, j, cb_long; int leftChanNum; int isRightWithCommonWindow; double num_bit, snr[SBMAX_L]; double energy[BLOCK_LEN_LONG], snr_p[BLOCK_LEN_LONG], temp1, temp2; ChannelInfo *thisChannel; /* Set pointers for specified channel number */ /* int psy_init; */ int *psy_init; double (*dr)[BLOCK_LEN_LONG],(*e)[BLOCK_LEN_LONG]; double (*K)[BLOCK_LEN_LONG], (*R)[BLOCK_LEN_LONG]; double (*VAR)[BLOCK_LEN_LONG], (*KOR)[BLOCK_LEN_LONG]; double *sb_samples_pred; int *thisLineNeedsResetting; /* int reset_count; */ int *reset_count; int *pred_global_flag; int *pred_sfb_flag; int *reset_group; /* Set pointers for this chanNum */ pred_global_flag = &(coderInfo[chanNum].pred_global_flag); pred_sfb_flag = coderInfo[chanNum].pred_sfb_flag; reset_group = &(coderInfo[chanNum].reset_group_number); psy_init = &coderInfo[chanNum].bwpInfo.psy_init_mc; dr = &coderInfo[chanNum].bwpInfo.dr_mc[0]; e = &coderInfo[chanNum].bwpInfo.e_mc[0]; K = &coderInfo[chanNum].bwpInfo.K_mc[0]; R = &coderInfo[chanNum].bwpInfo.R_mc[0]; VAR = &coderInfo[chanNum].bwpInfo.VAR_mc[0]; KOR = &coderInfo[chanNum].bwpInfo.KOR_mc[0]; sb_samples_pred = &coderInfo[chanNum].bwpInfo.sb_samples_pred_mc[0]; thisLineNeedsResetting = &coderInfo[chanNum].bwpInfo.thisLineNeedsResetting_mc[0]; reset_count = &coderInfo[chanNum].bwpInfo.reset_count_mc; thisChannel = &(channelInfo[chanNum]); *psy_init = (*psy_init && (btype!=2)); if((*psy_init) == 0) { for (j=0; jch_is_left) { (*reset_count)++; if (*reset_count >= 31 * RESET_FRAME) *reset_count = RESET_FRAME; } return; } /**************************************************/ /* Compute state using last_spec */ /**************************************************/ for (i=0;i=1;j--) R[j][i] = A*(R[j-1][i]-dr[j][i]); R[0][i] = A*e[0][i]; } /**************************************************/ /* Reset state here if resets were sent */ /**************************************************/ for (i=0;iMINVAR) K[j][i] = KOR[j][i]/VAR[j][i]*B; else K[j][i] = 0; } } for (k=0; kcpe)&&( !(thisChannel->ch_is_left))) { leftChanNum = thisChannel->paired_ch; if (channelInfo[leftChanNum].common_window) { isRightWithCommonWindow = 1; } } if (isRightWithCommonWindow) { /**************************************************/ /* Use predictor data from the left channel. */ /**************************************************/ CopyPredInfo(&(coderInfo[chanNum]),&(coderInfo[leftChanNum])); /* Make sure to turn off bands with intensity stereo */ #if 0 if (thisChannel->is_info.is_present) { for (i=0; iis_info.is_used[i]) { pred_sfb_flag[i] = 0; } } } #endif cb_long=0; for (i=0; i0.0) num_bit+=snr[i]/6.*isfb_width[i]; /* Determine global enable, if not enabled predicted samples are zeroed */ pred_global_flag[0]=1; if(num_bit<50) { pred_global_flag[0]=0; num_bit=0.0; for (j=0; jcpe)&&( !(thisChannel->ch_is_left))) { /* if (!thisChannel->ch_is_left) {*/ /**********************************************************/ /* Using predictor reset data from the left channel. */ /**********************************************************/ reset_count = &coderInfo[leftChanNum].bwpInfo.reset_count_mc; /* Reset the frame counter */ for (i=0;i= 31 * RESET_FRAME) *reset_count = RESET_FRAME; if (*reset_count % RESET_FRAME == 0) { /* Send a reset in this frame */ *reset_group = *reset_count / 8; for (i = *reset_group - 1; i < BLOCK_LEN_LONG; i += 30) { thisLineNeedsResetting[i]=1; } } else *reset_group = -1; } /* Ensure that prediction data is sent when there is a prediction * reset. */ if (*reset_group != -1 && pred_global_flag[0] == 0) { pred_global_flag[0] = 1; for (i = 0; i < nsfb; i++) pred_sfb_flag[i] = 0; } } void CopyPredInfo(CoderInfo *right, CoderInfo *left) { int band; right->pred_global_flag = left->pred_global_flag; right->reset_group_number = left->reset_group_number; for (band = 0; bandpred_sfb_flag[band] = left->pred_sfb_flag[band]; } } faac-1.28/libfaac/backpred.h0000644010307701030770000000310207310211345017341 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: backpred.h,v 1.5 2001/06/08 18:01:09 menno Exp $ */ #ifndef _AAC_BACK_H_INCLUDED #define _AAC_BACK_H_INCLUDED #define PRED_ALPHA 0.90625 #define PRED_A 0.953125 #define PRED_B 0.953125 #define ALPHA PRED_ALPHA #define A PRED_A #define B PRED_B #define MINVAR 1.e-10 /* Reset every RESET_FRAME frames. */ #define RESET_FRAME 8 void PredCalcPrediction(double *act_spec, double *last_spec, int btype, int nsfb, int *isfb_width, CoderInfo *coderInfo, ChannelInfo *channelInfo, int chanNum); void PredInit(faacEncHandle hEncoder); void CopyPredInfo(CoderInfo *right, CoderInfo *left); #endif faac-1.28/libfaac/bitstream.c0000644010307701030770000014267010631331243017571 0ustar fabian-guestfabian-guest/********************************************************************** This software module was originally developed by and edited by Texas Instruments in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1997. **********************************************************************/ /* * $Id: bitstream.c,v 1.34 2007/06/05 18:59:47 menno Exp $ */ #include #include #include "coder.h" #include "channels.h" #include "huffman.h" #include "bitstream.h" #include "ltp.h" #include "util.h" static int CountBitstream(faacEncHandle hEncoder, CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int numChannels); static int WriteADTSHeader(faacEncHandle hEncoder, BitStream *bitStream, int writeFlag); static int WriteCPE(CoderInfo *coderInfoL, CoderInfo *coderInfoR, ChannelInfo *channelInfo, BitStream* bitStream, int objectType, int writeFlag); static int WriteSCE(CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int objectType, int writeFlag); static int WriteLFE(CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int objectType, int writeFlag); static int WriteICSInfo(CoderInfo *coderInfo, BitStream *bitStream, int objectType, int common_window, int writeFlag); static int WriteICS(CoderInfo *coderInfo, BitStream *bitStream, int commonWindow, int objectType, int writeFlag); static int WriteLTPPredictorData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WritePredictorData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WritePulseData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WriteTNSData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WriteGainControlData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WriteSpectralData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static int WriteAACFillBits(BitStream* bitStream, int numBits, int writeFlag); static int FindGroupingBits(CoderInfo *coderInfo); static long BufferNumBit(BitStream *bitStream); static int WriteByte(BitStream *bitStream, unsigned long data, int numBit); static int ByteAlign(BitStream* bitStream, int writeFlag, int bitsSoFar); #ifdef DRM static int PutBitHcr(BitStream *bitStream, unsigned long curpos, unsigned long data, int numBit); static int rewind_word(int W, int len); static int WriteReorderedSpectralData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); static void calc_CRC(BitStream *bitStream, int len); #endif static int WriteFAACStr(BitStream *bitStream, char *version, int write) { int i; char str[200]; int len, padbits, count; int bitcnt; sprintf(str, "libfaac %s", version); len = strlen(str) + 1; padbits = (8 - ((bitStream->numBit + 7) % 8)) % 8; count = len + 3; bitcnt = LEN_SE_ID + 4 + ((count < 15) ? 0 : 8) + count * 8; if (!write) return bitcnt; PutBit(bitStream, ID_FIL, LEN_SE_ID); if (count < 15) { PutBit(bitStream, count, 4); } else { PutBit(bitStream, 15, 4); PutBit(bitStream, count - 14, 8); } PutBit(bitStream, 0, padbits); PutBit(bitStream, 0, 8); PutBit(bitStream, 0, 8); // just in case for (i = 0; i < len; i++) PutBit(bitStream, str[i], 8); PutBit(bitStream, 0, 8 - padbits); return bitcnt; } int WriteBitstream(faacEncHandle hEncoder, CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int numChannel) { int channel; int bits = 0; int bitsLeftAfterFill, numFillBits; CountBitstream(hEncoder, coderInfo, channelInfo, bitStream, numChannel); if(hEncoder->config.outputFormat == 1){ bits += WriteADTSHeader(hEncoder, bitStream, 1); }else{ bits = 0; // compilier will remove it, byt anyone will see that current size of bitstream is 0 } /* sur: faad2 complains about scalefactor error if we are writing FAAC String */ #ifndef DRM if (hEncoder->frameNum == 4) WriteFAACStr(bitStream, hEncoder->config.name, 1); #endif for (channel = 0; channel < numChannel; channel++) { if (channelInfo[channel].present) { /* Write out a single_channel_element */ if (!channelInfo[channel].cpe) { if (channelInfo[channel].lfe) { /* Write out lfe */ bits += WriteLFE(&coderInfo[channel], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 1); } else { /* Write out sce */ bits += WriteSCE(&coderInfo[channel], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 1); } } else { if (channelInfo[channel].ch_is_left) { /* Write out cpe */ bits += WriteCPE(&coderInfo[channel], &coderInfo[channelInfo[channel].paired_ch], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 1); } } } } /* Compute how many fill bits are needed to avoid overflowing bit reservoir */ /* Save room for ID_END terminator */ if (bits < (8 - LEN_SE_ID) ) { numFillBits = 8 - LEN_SE_ID - bits; } else { numFillBits = 0; } /* Write AAC fill_elements, smallest fill element is 7 bits. */ /* Function may leave up to 6 bits left after fill, so tell it to fill a few extra */ numFillBits += 6; bitsLeftAfterFill = WriteAACFillBits(bitStream, numFillBits, 1); bits += (numFillBits - bitsLeftAfterFill); /* Write ID_END terminator */ bits += LEN_SE_ID; PutBit(bitStream, ID_END, LEN_SE_ID); /* Now byte align the bitstream */ /* * This byte_alignment() is correct for both MPEG2 and MPEG4, although * in MPEG4 the byte_alignment() is officially done before the new frame * instead of at the end. But this is basically the same. */ bits += ByteAlign(bitStream, 1, bits); return bits; } static int CountBitstream(faacEncHandle hEncoder, CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int numChannel) { int channel; int bits = 0; int bitsLeftAfterFill, numFillBits; if(hEncoder->config.outputFormat == 1){ bits += WriteADTSHeader(hEncoder, bitStream, 0); }else{ bits = 0; // compilier will remove it, byt anyone will see that current size of bitstream is 0 } /* sur: faad2 complains about scalefactor error if we are writing FAAC String */ #ifndef DRM if (hEncoder->frameNum == 4) bits += WriteFAACStr(bitStream, hEncoder->config.name, 0); #endif for (channel = 0; channel < numChannel; channel++) { if (channelInfo[channel].present) { /* Write out a single_channel_element */ if (!channelInfo[channel].cpe) { if (channelInfo[channel].lfe) { /* Write out lfe */ bits += WriteLFE(&coderInfo[channel], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 0); } else { /* Write out sce */ bits += WriteSCE(&coderInfo[channel], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 0); } } else { if (channelInfo[channel].ch_is_left) { /* Write out cpe */ bits += WriteCPE(&coderInfo[channel], &coderInfo[channelInfo[channel].paired_ch], &channelInfo[channel], bitStream, hEncoder->config.aacObjectType, 0); } } } } /* Compute how many fill bits are needed to avoid overflowing bit reservoir */ /* Save room for ID_END terminator */ if (bits < (8 - LEN_SE_ID) ) { numFillBits = 8 - LEN_SE_ID - bits; } else { numFillBits = 0; } /* Write AAC fill_elements, smallest fill element is 7 bits. */ /* Function may leave up to 6 bits left after fill, so tell it to fill a few extra */ numFillBits += 6; bitsLeftAfterFill = WriteAACFillBits(bitStream, numFillBits, 0); bits += (numFillBits - bitsLeftAfterFill); /* Write ID_END terminator */ bits += LEN_SE_ID; /* Now byte align the bitstream */ bits += ByteAlign(bitStream, 0, bits); hEncoder->usedBytes = bit2byte(bits); return bits; } static int WriteADTSHeader(faacEncHandle hEncoder, BitStream *bitStream, int writeFlag) { int bits = 56; if (writeFlag) { /* Fixed ADTS header */ PutBit(bitStream, 0xFFFF, 12); /* 12 bit Syncword */ PutBit(bitStream, hEncoder->config.mpegVersion, 1); /* ID == 0 for MPEG4 AAC, 1 for MPEG2 AAC */ PutBit(bitStream, 0, 2); /* layer == 0 */ PutBit(bitStream, 1, 1); /* protection absent */ PutBit(bitStream, hEncoder->config.aacObjectType - 1, 2); /* profile */ PutBit(bitStream, hEncoder->sampleRateIdx, 4); /* sampling rate */ PutBit(bitStream, 0, 1); /* private bit */ PutBit(bitStream, hEncoder->numChannels, 3); /* ch. config (must be > 0) */ /* simply using numChannels only works for 6 channels or less, else a channel configuration should be written */ PutBit(bitStream, 0, 1); /* original/copy */ PutBit(bitStream, 0, 1); /* home */ #if 0 // Removed in corrigendum 14496-3:2002 if (hEncoder->config.mpegVersion == 0) PutBit(bitStream, 0, 2); /* emphasis */ #endif /* Variable ADTS header */ PutBit(bitStream, 0, 1); /* copyr. id. bit */ PutBit(bitStream, 0, 1); /* copyr. id. start */ PutBit(bitStream, hEncoder->usedBytes, 13); PutBit(bitStream, 0x7FF, 11); /* buffer fullness (0x7FF for VBR) */ PutBit(bitStream, 0, 2); /* raw data blocks (0+1=1) */ } /* * MPEG2 says byte_aligment() here, but ADTS always is multiple of 8 bits * MPEG4 has no byte_alignment() here */ /* if (hEncoder->config.mpegVersion == 1) bits += ByteAlign(bitStream, writeFlag); */ #if 0 // Removed in corrigendum 14496-3:2002 if (hEncoder->config.mpegVersion == 0) bits += 2; /* emphasis */ #endif return bits; } static int WriteCPE(CoderInfo *coderInfoL, CoderInfo *coderInfoR, ChannelInfo *channelInfo, BitStream* bitStream, int objectType, int writeFlag) { int bits = 0; #ifndef DRM if (writeFlag) { /* write ID_CPE, single_element_channel() identifier */ PutBit(bitStream, ID_CPE, LEN_SE_ID); /* write the element_identifier_tag */ PutBit(bitStream, channelInfo->tag, LEN_TAG); /* common_window? */ PutBit(bitStream, channelInfo->common_window, LEN_COM_WIN); } bits += LEN_SE_ID; bits += LEN_TAG; bits += LEN_COM_WIN; #endif /* if common_window, write ics_info */ if (channelInfo->common_window) { int numWindows, maxSfb; bits += WriteICSInfo(coderInfoL, bitStream, objectType, channelInfo->common_window, writeFlag); numWindows = coderInfoL->num_window_groups; maxSfb = coderInfoL->max_sfb; if (writeFlag) { PutBit(bitStream, channelInfo->msInfo.is_present, LEN_MASK_PRES); if (channelInfo->msInfo.is_present == 1) { int g; int b; for (g=0;gmsInfo.ms_used[g*maxSfb+b], LEN_MASK); } } } } bits += LEN_MASK_PRES; if (channelInfo->msInfo.is_present == 1) bits += (numWindows*maxSfb*LEN_MASK); } /* Write individual_channel_stream elements */ bits += WriteICS(coderInfoL, bitStream, channelInfo->common_window, objectType, writeFlag); bits += WriteICS(coderInfoR, bitStream, channelInfo->common_window, objectType, writeFlag); return bits; } static int WriteSCE(CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int objectType, int writeFlag) { int bits = 0; #ifndef DRM if (writeFlag) { /* write Single Element Channel (SCE) identifier */ PutBit(bitStream, ID_SCE, LEN_SE_ID); /* write the element identifier tag */ PutBit(bitStream, channelInfo->tag, LEN_TAG); } bits += LEN_SE_ID; bits += LEN_TAG; #endif /* Write an Individual Channel Stream element */ bits += WriteICS(coderInfo, bitStream, 0, objectType, writeFlag); return bits; } static int WriteLFE(CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int objectType, int writeFlag) { int bits = 0; if (writeFlag) { /* write ID_LFE, lfe_element_channel() identifier */ PutBit(bitStream, ID_LFE, LEN_SE_ID); /* write the element_identifier_tag */ PutBit(bitStream, channelInfo->tag, LEN_TAG); } bits += LEN_SE_ID; bits += LEN_TAG; /* Write an individual_channel_stream element */ bits += WriteICS(coderInfo, bitStream, 0, objectType, writeFlag); return bits; } static int WriteICSInfo(CoderInfo *coderInfo, BitStream *bitStream, int objectType, int common_window, int writeFlag) { int grouping_bits; int bits = 0; if (writeFlag) { /* write out ics_info() information */ PutBit(bitStream, 0, LEN_ICS_RESERV); /* reserved Bit*/ /* Write out window sequence */ PutBit(bitStream, coderInfo->block_type, LEN_WIN_SEQ); /* block type */ /* Write out window shape */ PutBit(bitStream, coderInfo->window_shape, LEN_WIN_SH); /* window shape */ } bits += LEN_ICS_RESERV; bits += LEN_WIN_SEQ; bits += LEN_WIN_SH; /* For short windows, write out max_sfb and scale_factor_grouping */ if (coderInfo->block_type == ONLY_SHORT_WINDOW){ if (writeFlag) { PutBit(bitStream, coderInfo->max_sfb, LEN_MAX_SFBS); grouping_bits = FindGroupingBits(coderInfo); PutBit(bitStream, grouping_bits, MAX_SHORT_WINDOWS - 1); /* the grouping bits */ } bits += LEN_MAX_SFBS; bits += MAX_SHORT_WINDOWS - 1; } else { /* Otherwise, write out max_sfb and predictor data */ if (writeFlag) { PutBit(bitStream, coderInfo->max_sfb, LEN_MAX_SFBL); } bits += LEN_MAX_SFBL; #ifdef DRM } if (writeFlag) { PutBit(bitStream,coderInfo->tnsInfo.tnsDataPresent,LEN_TNS_PRES); } bits += LEN_TNS_PRES; #endif if (objectType == LTP) { bits++; if(writeFlag) PutBit(bitStream, coderInfo->ltpInfo.global_pred_flag, 1); /* Prediction Global used */ bits += WriteLTPPredictorData(coderInfo, bitStream, writeFlag); if (common_window) bits += WriteLTPPredictorData(coderInfo, bitStream, writeFlag); } else { bits++; if (writeFlag) PutBit(bitStream, coderInfo->pred_global_flag, LEN_PRED_PRES); /* predictor_data_present */ bits += WritePredictorData(coderInfo, bitStream, writeFlag); } #ifndef DRM } #endif return bits; } static int WriteICS(CoderInfo *coderInfo, BitStream *bitStream, int commonWindow, int objectType, int writeFlag) { /* this function writes out an individual_channel_stream to the bitstream and */ /* returns the number of bits written to the bitstream */ int bits = 0; #ifndef DRM /* Write the 8-bit global_gain */ if (writeFlag) PutBit(bitStream, coderInfo->global_gain, LEN_GLOB_GAIN); bits += LEN_GLOB_GAIN; #endif /* Write ics information */ if (!commonWindow) { bits += WriteICSInfo(coderInfo, bitStream, objectType, commonWindow, writeFlag); } #ifdef DRM /* Write the 8-bit global_gain */ if (writeFlag) PutBit(bitStream, coderInfo->global_gain, LEN_GLOB_GAIN); bits += LEN_GLOB_GAIN; #endif bits += SortBookNumbers(coderInfo, bitStream, writeFlag); bits += WriteScalefactors(coderInfo, bitStream, writeFlag); #ifdef DRM if (writeFlag) { /* length_of_reordered_spectral_data */ PutBit(bitStream, coderInfo->iLenReordSpData, LEN_HCR_REORDSD); /* length_of_longest_codeword */ PutBit(bitStream, coderInfo->iLenLongestCW, LEN_HCR_LONGCW); } bits += LEN_HCR_REORDSD + LEN_HCR_LONGCW; #else bits += WritePulseData(coderInfo, bitStream, writeFlag); #endif bits += WriteTNSData(coderInfo, bitStream, writeFlag); #ifndef DRM bits += WriteGainControlData(coderInfo, bitStream, writeFlag); #endif #ifdef DRM /* DRM CRC calculation */ if (writeFlag) calc_CRC(bitStream, bits); bits += WriteReorderedSpectralData(coderInfo, bitStream, writeFlag); #else bits += WriteSpectralData(coderInfo, bitStream, writeFlag); #endif /* Return number of bits */ return bits; } static int WriteLTPPredictorData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { int i, last_band; int bits; LtpInfo *ltpInfo = &coderInfo->ltpInfo; bits = 0; if (ltpInfo->global_pred_flag) { if(writeFlag) PutBit(bitStream, 1, 1); /* LTP used */ bits++; switch(coderInfo->block_type) { case ONLY_LONG_WINDOW: case LONG_SHORT_WINDOW: case SHORT_LONG_WINDOW: bits += LEN_LTP_LAG; bits += LEN_LTP_COEF; if(writeFlag) { PutBit(bitStream, ltpInfo->delay[0], LEN_LTP_LAG); PutBit(bitStream, ltpInfo->weight_idx, LEN_LTP_COEF); } last_band = ((coderInfo->nr_of_sfb < MAX_LT_PRED_LONG_SFB) ? coderInfo->nr_of_sfb : MAX_LT_PRED_LONG_SFB); // last_band = coderInfo->nr_of_sfb; bits += last_band; if(writeFlag) for (i = 0; i < last_band; i++) PutBit(bitStream, ltpInfo->sfb_prediction_used[i], LEN_LTP_LONG_USED); break; default: break; } } return (bits); } static int WritePredictorData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { int bits = 0; /* Write global predictor data present */ short predictorDataPresent = coderInfo->pred_global_flag; int numBands = min(coderInfo->max_pred_sfb, coderInfo->nr_of_sfb); if (writeFlag) { if (predictorDataPresent) { int b; if (coderInfo->reset_group_number == -1) { PutBit(bitStream, 0, LEN_PRED_RST); /* No prediction reset */ } else { PutBit(bitStream, 1, LEN_PRED_RST); PutBit(bitStream, (unsigned long)coderInfo->reset_group_number, LEN_PRED_RSTGRP); } for (b=0;bpred_sfb_flag[b], LEN_PRED_ENAB); } } } bits += (predictorDataPresent) ? (LEN_PRED_RST + ((coderInfo->reset_group_number)!=-1)*LEN_PRED_RSTGRP + numBands*LEN_PRED_ENAB) : 0; return bits; } static int WritePulseData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { int bits = 0; if (writeFlag) { PutBit(bitStream, 0, LEN_PULSE_PRES); /* no pulse_data_present */ } bits += LEN_PULSE_PRES; return bits; } static int WriteTNSData(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { int bits = 0; int numWindows; int len_tns_nfilt; int len_tns_length; int len_tns_order; int filtNumber; int resInBits; int bitsToTransmit; unsigned long unsignedIndex; int w; TnsInfo* tnsInfoPtr = &coderInfo->tnsInfo; #ifndef DRM if (writeFlag) { PutBit(bitStream,tnsInfoPtr->tnsDataPresent,LEN_TNS_PRES); } bits += LEN_TNS_PRES; #endif /* If TNS is not present, bail */ if (!tnsInfoPtr->tnsDataPresent) { return bits; } /* Set window-dependent TNS parameters */ if (coderInfo->block_type == ONLY_SHORT_WINDOW) { numWindows = MAX_SHORT_WINDOWS; len_tns_nfilt = LEN_TNS_NFILTS; len_tns_length = LEN_TNS_LENGTHS; len_tns_order = LEN_TNS_ORDERS; } else { numWindows = 1; len_tns_nfilt = LEN_TNS_NFILTL; len_tns_length = LEN_TNS_LENGTHL; len_tns_order = LEN_TNS_ORDERL; } /* Write TNS data */ bits += (numWindows * len_tns_nfilt); for (w=0;wwindowData[w]; int numFilters = windowDataPtr->numFilters; if (writeFlag) { PutBit(bitStream,numFilters,len_tns_nfilt); /* n_filt[] = 0 */ } if (numFilters) { bits += LEN_TNS_COEFF_RES; resInBits = windowDataPtr->coefResolution; if (writeFlag) { PutBit(bitStream,resInBits-DEF_TNS_RES_OFFSET,LEN_TNS_COEFF_RES); } bits += numFilters * (len_tns_length+len_tns_order); for (filtNumber=0;filtNumbertnsFilter[filtNumber]; int order = tnsFilterPtr->order; if (writeFlag) { PutBit(bitStream,tnsFilterPtr->length,len_tns_length); PutBit(bitStream,order,len_tns_order); } if (order) { bits += (LEN_TNS_DIRECTION + LEN_TNS_COMPRESS); if (writeFlag) { PutBit(bitStream,tnsFilterPtr->direction,LEN_TNS_DIRECTION); PutBit(bitStream,tnsFilterPtr->coefCompress,LEN_TNS_COMPRESS); } bitsToTransmit = resInBits - tnsFilterPtr->coefCompress; bits += order * bitsToTransmit; if (writeFlag) { int i; for (i=1;i<=order;i++) { unsignedIndex = (unsigned long) (tnsFilterPtr->index[i])&(~(~0<data; int* len = coderInfo->len; if (writeFlag) { for(i = 0; i < coderInfo->spectral_count; i++) { if (len[i] > 0) { /* only send out non-zero codebook data */ PutBit(bitStream, data[i], len[i]); /* write data */ bits += len[i]; } } } else { for(i = 0; i < coderInfo->spectral_count; i++) { bits += len[i]; } } return bits; } static int WriteAACFillBits(BitStream* bitStream, int numBits, int writeFlag) { int numberOfBitsLeft = numBits; /* Need at least (LEN_SE_ID + LEN_F_CNT) bits for a fill_element */ int minNumberOfBits = LEN_SE_ID + LEN_F_CNT; while (numberOfBitsLeft >= minNumberOfBits) { int numberOfBytes; int maxCount; if (writeFlag) { PutBit(bitStream, ID_FIL, LEN_SE_ID); /* Write fill_element ID */ } numberOfBitsLeft -= minNumberOfBits; /* Subtract for ID,count */ numberOfBytes = (int)(numberOfBitsLeft/LEN_BYTE); maxCount = (1< maxNumberOfBytes ) ? (maxNumberOfBytes) : (numberOfBytes); escCount = numberOfBytes - maxCount; if (writeFlag) { PutBit(bitStream, escCount, LEN_BYTE); for (i = 0; i < numberOfBytes-1; i++) { PutBit(bitStream, 0, LEN_BYTE); } } } numberOfBitsLeft -= LEN_BYTE*numberOfBytes; } return numberOfBitsLeft; } static int FindGroupingBits(CoderInfo *coderInfo) { /* This function inputs the grouping information and outputs the seven bit 'grouping_bits' field that the AAC decoder expects. */ int grouping_bits = 0; int tmp[8]; int i, j; int index = 0; for(i = 0; i < coderInfo->num_window_groups; i++){ for (j = 0; j < coderInfo->window_group_length[i]; j++){ tmp[index++] = i; } } for(i = 1; i < 8; i++){ grouping_bits = grouping_bits << 1; if(tmp[i] == tmp[i-1]) { grouping_bits++; } } return grouping_bits; } /* size in bytes! */ BitStream *OpenBitStream(int size, unsigned char *buffer) { BitStream *bitStream; bitStream = AllocMemory(sizeof(BitStream)); bitStream->size = size; #ifdef DRM /* skip first byte for CRC */ bitStream->numBit = 8; bitStream->currentBit = 8; #else bitStream->numBit = 0; bitStream->currentBit = 0; #endif bitStream->data = buffer; SetMemory(bitStream->data, 0, size); return bitStream; } int CloseBitStream(BitStream *bitStream) { int bytes = bit2byte(bitStream->numBit); FreeMemory(bitStream); return bytes; } static long BufferNumBit(BitStream *bitStream) { return bitStream->numBit; } static int WriteByte(BitStream *bitStream, unsigned long data, int numBit) { long numUsed,idx; idx = (bitStream->currentBit / BYTE_NUMBIT) % bitStream->size; numUsed = bitStream->currentBit % BYTE_NUMBIT; #ifndef DRM if (numUsed == 0) bitStream->data[idx] = 0; #endif bitStream->data[idx] |= (data & ((1<currentBit += numBit; bitStream->numBit = bitStream->currentBit; return 0; } int PutBit(BitStream *bitStream, unsigned long data, int numBit) { int num,maxNum,curNum; unsigned long bits; if (numBit == 0) return 0; /* write bits in packets according to buffer byte boundaries */ num = 0; maxNum = BYTE_NUMBIT - bitStream->currentBit % BYTE_NUMBIT; while (num < numBit) { curNum = min(numBit-num,maxNum); bits = data>>(numBit-num-curNum); if (WriteByte(bitStream, bits, curNum)) { return 1; } num += curNum; maxNum = BYTE_NUMBIT; } return 0; } static int ByteAlign(BitStream *bitStream, int writeFlag, int bitsSoFar) { int len, i,j; if (writeFlag) { len = BufferNumBit(bitStream); } else { len = bitsSoFar; } j = (8 - (len%8))%8; if ((len % 8) == 0) j = 0; if (writeFlag) { for( i=0; icurrentBit = curpos; return PutBit(bitStream, data, numBit); } static int rewind_word(int W, int len) { /* rewind len (max. 32) bits so that the MSB becomes LSB */ short i; int tmp_W = 0; for (i = 0; i < len; i++) { tmp_W <<= 1; if (W & (1<window_group_length; int* sfb_offset = coderInfo->sfb_offset; cw_info_t cw_info[FRAME_LEN]; cw_info_t cw_info_preso[FRAME_LEN]; int num_cw = coderInfo->cur_cw; int window_cw_cnt[MAX_SHORT_WINDOWS] = {0,0,0,0,0,0,0,0}; int presort, set, num_sets; unsigned short cur_cb, cw_cnt; short is_backwards; int diff, tmp_data, cw_part_cnt, cur_cw_part; int cur_cw_len, cur_data; int sfb_cnt, win_cnt, acc_win_cnt, win_grp_cnt; int coeff_cnt, last_sfb, cur_sfb_len; /* set up local pointers to data and len */ /* data array contains data to be written */ /* len array contains lengths of data words */ int* data = coderInfo->data; int* len = coderInfo->len; int* num_data = coderInfo->num_data_cw; if (writeFlag) { /* build offset table */ cur_data = 0; cw_info[0].cw_offset = 0; for (i = 0; i < num_cw; i++) { cur_cw_len = 0; for (j = 0; j < num_data[i]; j++) { cur_cw_len += len[cur_data++]; } cw_info[i].num_data = num_data[i]; cw_info[i].cw_len = cur_cw_len; if (i > 0) /* calculate offset (codeword info parameter) */ cw_info[i].cw_offset = cw_info[i - 1].cw_offset + num_data[i - 1]; } /* presort codewords ------------------------------------------------ */ /* classify codewords first */ sfb_cnt = win_cnt = win_grp_cnt = coeff_cnt = last_sfb = acc_win_cnt = 0; cur_sfb_len = sfb_offset[1] / window_group_length[0]; cur_cb = coderInfo->book_vector[0]; for (i = 0; i < num_cw; i++) { /* Set codeword info parameters */ cw_info[i].cb = cur_cb; cw_info[i].num_sl_cw = (cur_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; cw_info[i].window = acc_win_cnt + win_cnt; cw_info[i].cw_nr = window_cw_cnt[cw_info[i].window]; window_cw_cnt[cw_info[i].window]++; coeff_cnt += cw_info[i].num_sl_cw; if (coeff_cnt - last_sfb >= cur_sfb_len) { last_sfb += cur_sfb_len; win_cnt++; /* next window */ if (win_cnt == window_group_length[win_grp_cnt]) { win_cnt = 0; sfb_cnt++; /* next sfb */ if (sfb_cnt == coderInfo->all_sfb) { sfb_cnt = 0; acc_win_cnt += window_group_length[win_grp_cnt]; win_grp_cnt++; /* next window group */ } /* new codebook and sfb length */ cur_cb = coderInfo->book_vector[sfb_cnt]; if (last_sfb < FRAME_LEN) { cur_sfb_len = (sfb_offset[sfb_cnt + 1] - sfb_offset[sfb_cnt]) / window_group_length[win_grp_cnt]; } } } } /* presorting (first presorting step) */ /* only needed for short windows */ /* Somehow the second presorting step does not give expected results. Disabling the following code surprisingly gives good results. TODO: find the bug */ if (0) {//coderInfo->block_type == ONLY_SHORT_WINDOW) { for (i = 0; i < MAX_SHORT_WINDOWS; i++) window_cw_cnt[i] = 0; /* reset all counters */ win_cnt = 0; cw_cnt = 0; for (i = 0; i < num_cw; i++) { for (j = 0; j < num_cw; j++) { if (cw_info[j].window == win_cnt) { if (cw_info[j].cw_nr == window_cw_cnt[win_cnt]) { cw_info_preso[cw_cnt++] = cw_info[j]; window_cw_cnt[win_cnt]++; /* check if two one-dimensional codewords */ if (cw_info[j].num_sl_cw == PAIR_LEN) { cw_info_preso[cw_cnt++] = cw_info[j + 1]; window_cw_cnt[win_cnt]++; } win_cnt++; /* next window */ if (win_cnt == MAX_SHORT_WINDOWS) win_cnt = 0; } } } } } else { for (i = 0; i < num_cw; i++) { cw_info_preso[i] = cw_info[i]; /* just copy */ } } /* presorting (second presorting step) */ cw_cnt = 0; for (presort = 0; presort < LEN_PRESORT_CODEBOOK; presort++) { /* next codebook that has to be processed according to presorting */ unsigned short nextCB = PresortedCodebook_VCB11[presort]; for (i = 0; i < num_cw; i++) { /* process only codewords that are due now */ if ((cw_info_preso[i].cb == nextCB) || ((nextCB < ESC_HCB) && (cw_info_preso[i].cb == nextCB + 1))) { cw_info[cw_cnt++] = cw_info_preso[i]; } } } /* init segments */ accsegmsize = 0; for (i = 0; i < num_cw; i++) { /* 8.5.3.3.3.2 Derivation of segment width */ cursegmsize = min(maxCwLen[cw_info[i].cb], coderInfo->iLenLongestCW); if (accsegmsize + cursegmsize > coderInfo->iLenReordSpData) { /* the last segment is extended until iLenReordSpData */ segment[segmcnt - 1].right = coderInfo->iLenReordSpData - 1; segment[segmcnt - 1].len = coderInfo->iLenReordSpData - segment[segmcnt - 1].left; break; } segment[segmcnt].left = accsegmsize; segment[segmcnt].right = accsegmsize + cursegmsize - 1; segment[segmcnt++].len = cursegmsize; accsegmsize += cursegmsize; } /* store current bit position */ startbitpos = bitStream->currentBit; /* write write priority codewords (PCWs) and nonPCWs ---------------- */ num_sets = num_cw / segmcnt; /* number of sets */ for (set = 0; set <= num_sets; set++) { int trial; /* ever second set the bit order is reversed */ is_backwards = set % 2; for (trial = 0; trial < segmcnt; trial++) { int codewordBase; int set_encoded = segmcnt; if (set == num_sets) set_encoded = num_cw - set * segmcnt; /* last set is shorter than the rest */ for (codewordBase = 0; codewordBase < segmcnt; codewordBase++) { int segment_index = (trial + codewordBase) % segmcnt; int codeword_index = codewordBase + set * segmcnt; if (codeword_index >= num_cw) break; if ((cw_info[codeword_index].cw_len > 0) && (segment[segment_index].len > 0)) { /* codeword is not yet written (completely) */ /* space left in this segment */ short tmplen; /* how many bits can be written? */ if (segment[segment_index].len >= cw_info[codeword_index].cw_len) { tmplen = cw_info[codeword_index].cw_len; set_encoded--; /* CW fits into segment */ } else { tmplen = segment[segment_index].len; } /* Adjust lengths */ cw_info[codeword_index].cw_len -= tmplen; segment[segment_index].len -= tmplen; /* write codewords to bitstream */ for (cw_part_cnt = 0; cw_part_cnt < cw_info[codeword_index].num_data; cw_part_cnt++) { cur_cw_part = cw_info[codeword_index].cw_offset + cw_part_cnt; if (len[cur_cw_part] <= tmplen) { /* write complete data, no partitioning */ if (is_backwards) { /* write data in reversed bit-order */ PutBitHcr(bitStream, startbitpos + segment[segment_index].right - len[cur_cw_part] + 1, rewind_word(data[cur_cw_part], len[cur_cw_part]), len[cur_cw_part]); segment[segment_index].right -= len[cur_cw_part]; } else { PutBitHcr(bitStream, startbitpos + segment[segment_index].left, data[cur_cw_part], len[cur_cw_part]); segment[segment_index].left += len[cur_cw_part]; } tmplen -= len[cur_cw_part]; len[cur_cw_part] = 0; } else { /* codeword part must be partitioned */ /* data must be taken from the left side */ tmp_data = data[cur_cw_part]; diff = len[cur_cw_part] - tmplen; tmp_data >>= diff; /* remove bits which are already used */ data[cur_cw_part] &= (1 << diff) - 1 /* diff number of ones */; len[cur_cw_part] = diff; if (is_backwards) { /* write data in reversed bit-order */ PutBitHcr(bitStream, startbitpos + segment[segment_index].right - tmplen + 1, rewind_word(tmp_data, tmplen), tmplen); segment[segment_index].right -= tmplen; } else { PutBitHcr(bitStream, startbitpos + segment[segment_index].left, tmp_data, tmplen); segment[segment_index].left += tmplen; } tmplen = 0; } if (tmplen == 0) break; /* all data written for this segment trial */ } } } /* of codewordBase */ if (set_encoded == 0) break; /* no unencoded codewords left in this set */ } /* of trial */ } /* set parameter for bit stream to current correct position */ bitStream->currentBit = startbitpos + coderInfo->iLenReordSpData; bitStream->numBit = bitStream->currentBit; } return coderInfo->iLenReordSpData; } /* CRC8 x^8 + x^4 + x^3 + x^2 + 1 */ static const unsigned char _crctable[256] = { 0x00, 0x1D, 0x3A, 0x27, 0x74, 0x69, 0x4E, 0x53, 0xE8, 0xF5, 0xD2, 0xCF, 0x9C, 0x81, 0xA6, 0xBB, 0xCD, 0xD0, 0xF7, 0xEA, 0xB9, 0xA4, 0x83, 0x9E, 0x25, 0x38, 0x1F, 0x02, 0x51, 0x4C, 0x6B, 0x76, 0x87, 0x9A, 0xBD, 0xA0, 0xF3, 0xEE, 0xC9, 0xD4, 0x6F, 0x72, 0x55, 0x48, 0x1B, 0x06, 0x21, 0x3C, 0x4A, 0x57, 0x70, 0x6D, 0x3E, 0x23, 0x04, 0x19, 0xA2, 0xBF, 0x98, 0x85, 0xD6, 0xCB, 0xEC, 0xF1, 0x13, 0x0E, 0x29, 0x34, 0x67, 0x7A, 0x5D, 0x40, 0xFB, 0xE6, 0xC1, 0xDC, 0x8F, 0x92, 0xB5, 0xA8, 0xDE, 0xC3, 0xE4, 0xF9, 0xAA, 0xB7, 0x90, 0x8D, 0x36, 0x2B, 0x0C, 0x11, 0x42, 0x5F, 0x78, 0x65, 0x94, 0x89, 0xAE, 0xB3, 0xE0, 0xFD, 0xDA, 0xC7, 0x7C, 0x61, 0x46, 0x5B, 0x08, 0x15, 0x32, 0x2F, 0x59, 0x44, 0x63, 0x7E, 0x2D, 0x30, 0x17, 0x0A, 0xB1, 0xAC, 0x8B, 0x96, 0xC5, 0xD8, 0xFF, 0xE2, 0x26, 0x3B, 0x1C, 0x01, 0x52, 0x4F, 0x68, 0x75, 0xCE, 0xD3, 0xF4, 0xE9, 0xBA, 0xA7, 0x80, 0x9D, 0xEB, 0xF6, 0xD1, 0xCC, 0x9F, 0x82, 0xA5, 0xB8, 0x03, 0x1E, 0x39, 0x24, 0x77, 0x6A, 0x4D, 0x50, 0xA1, 0xBC, 0x9B, 0x86, 0xD5, 0xC8, 0xEF, 0xF2, 0x49, 0x54, 0x73, 0x6E, 0x3D, 0x20, 0x07, 0x1A, 0x6C, 0x71, 0x56, 0x4B, 0x18, 0x05, 0x22, 0x3F, 0x84, 0x99, 0xBE, 0xA3, 0xF0, 0xED, 0xCA, 0xD7, 0x35, 0x28, 0x0F, 0x12, 0x41, 0x5C, 0x7B, 0x66, 0xDD, 0xC0, 0xE7, 0xFA, 0xA9, 0xB4, 0x93, 0x8E, 0xF8, 0xE5, 0xC2, 0xDF, 0x8C, 0x91, 0xB6, 0xAB, 0x10, 0x0D, 0x2A, 0x37, 0x64, 0x79, 0x5E, 0x43, 0xB2, 0xAF, 0x88, 0x95, 0xC6, 0xDB, 0xFC, 0xE1, 0x5A, 0x47, 0x60, 0x7D, 0x2E, 0x33, 0x14, 0x09, 0x7F, 0x62, 0x45, 0x58, 0x0B, 0x16, 0x31, 0x2C, 0x97, 0x8A, 0xAD, 0xB0, 0xE3, 0xFE, 0xD9, 0xC4 }; static void calc_CRC(BitStream *bitStream, int len) { //int i; //unsigned char r = ~0; /* Initialize to all ones */ unsigned char crc = ~0; /* Initialize to all ones */ /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ unsigned int cb = len / 8; unsigned int taillen = len & 0x7; unsigned char* pb = &bitStream->data[1]; //compatible, but slower unsigned char b = ( bitStream->data[cb + 1] ) >> ( 8 - taillen ); unsigned char b = bitStream->data[cb + 1]; //#define GPOLY 0435 // // for (i = 8; i < len + 8; i++) { // r = ( (r << 1) ^ (( ( // ( bitStream->data[i / 8] >> (7 - (i % 8)) ) // & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; // } #define GP 0x1d //fprintf( stderr, "\nfaac:" ); while ( cb-- ) { //fprintf( stderr, " %02X", *pb ); crc = _crctable[ crc ^ *pb++ ]; } //compatible, but slower switch ( taillen ) //{ //case 7: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 6 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 6: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 5 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 5: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 4 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 4: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 3 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 3: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 2 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 2: // crc = ( ( crc << 1 ) ^ ( ( ( ( b >> 1 ) & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // // goto next case //case 1: // crc = ( ( crc << 1 ) ^ ( ( ( b & 1 ) ^ ( ( crc >> 7 ) & 1 ) ) * GP ) ) & 0xFF; // break; //} //fprintf( stderr, " %02X", ( b >> ( 8 - taillen ) ) << 7 ); switch ( taillen ) { case 7: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 6: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 5: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 4: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 3: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 2: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; b <<= 1; // goto next case case 1: crc = ( ( crc << 1 ) ^ ( ( (signed char)( b ^ crc ) >> 7 ) & GP ) ) & 0xFF; break; } //if ( crc != r ) //{ // fprintf( stderr, "%08X != %08X\n", crc, r ); //} //fprintf( stderr, " (%5d bits), CRC is %02X\n", len, ~crc & 0xFF ); /* CRC is stored inverted, per definition at first byte in stream */ bitStream->data[0] = ~crc; } #endif faac-1.28/libfaac/bitstream.h0000644010307701030770000001031710071771714017577 0ustar fabian-guestfabian-guest/********************************************************************** MPEG-4 Audio VM Bit stream module This software module was originally developed by Heiko Purnhagen (University of Hannover) and edited by in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1996. **********************************************************************/ /* * $Id: bitstream.h,v 1.14 2004/07/04 12:10:52 corrados Exp $ */ #ifndef BITSTREAM_H #define BITSTREAM_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "frame.h" #include "coder.h" #include "channels.h" /* * Raw bitstream constants */ #define LEN_SE_ID 3 #define LEN_TAG 4 #define LEN_GLOB_GAIN 8 #define LEN_COM_WIN 1 #define LEN_ICS_RESERV 1 #define LEN_WIN_SEQ 2 #define LEN_WIN_SH 1 #define LEN_MAX_SFBL 6 #define LEN_MAX_SFBS 4 #define LEN_CB 4 #define LEN_SCL_PCM 8 #define LEN_PRED_PRES 1 #define LEN_PRED_RST 1 #define LEN_PRED_RSTGRP 5 #define LEN_PRED_ENAB 1 #define LEN_MASK_PRES 2 #define LEN_MASK 1 #define LEN_PULSE_PRES 1 #define LEN_TNS_PRES 1 #define LEN_TNS_NFILTL 2 #define LEN_TNS_NFILTS 1 #define LEN_TNS_COEFF_RES 1 #define LEN_TNS_LENGTHL 6 #define LEN_TNS_LENGTHS 4 #define LEN_TNS_ORDERL 5 #define LEN_TNS_ORDERS 3 #define LEN_TNS_DIRECTION 1 #define LEN_TNS_COMPRESS 1 #define LEN_GAIN_PRES 1 #define LEN_NEC_NPULSE 2 #define LEN_NEC_ST_SFB 6 #define LEN_NEC_POFF 5 #define LEN_NEC_PAMP 4 #define NUM_NEC_LINES 4 #define NEC_OFFSET_AMP 4 #define LEN_NCC 3 #define LEN_IS_CPE 1 #define LEN_CC_LR 1 #define LEN_CC_DOM 1 #define LEN_CC_SGN 1 #define LEN_CCH_GES 2 #define LEN_CCH_CGP 1 #define LEN_D_CNT 4 #define LEN_D_ESC 12 #define LEN_F_CNT 4 #define LEN_F_ESC 8 #define LEN_BYTE 8 #define LEN_PAD_DATA 8 #define LEN_PC_COMM 8 #ifdef DRM # define LEN_HCR_REORDSD 14 # define LEN_HCR_LONGCW 6 # define FIRST_PAIR_HCB 5 # define QUAD_LEN 4 # define PAIR_LEN 2 # define ESC_HCB 11 #endif #define ID_SCE 0 #define ID_CPE 1 #define ID_CCE 2 #define ID_LFE 3 #define ID_DSE 4 #define ID_PCE 5 #define ID_FIL 6 #define ID_END 7 /* MPEG ID's */ #define MPEG2 1 #define MPEG4 0 /* AAC object types */ #define MAIN 1 #define LOW 2 #define SSR 3 #define LTP 4 #define BYTE_NUMBIT 8 /* bits in byte (char) */ #define LONG_NUMBIT 32 /* bits in unsigned long */ #define bit2byte(a) (((a)+BYTE_NUMBIT-1)/BYTE_NUMBIT) typedef struct { unsigned char *data; /* data bits */ long numBit; /* number of bits in buffer */ long size; /* buffer size in bytes */ long currentBit; /* current bit position in bit stream */ long numByte; /* number of bytes read/written (only file) */ } BitStream; int WriteBitstream(faacEncHandle hEncoder, CoderInfo *coderInfo, ChannelInfo *channelInfo, BitStream *bitStream, int numChannels); BitStream *OpenBitStream(int size, unsigned char *buffer); int CloseBitStream(BitStream *bitStream); int PutBit(BitStream *bitStream, unsigned long data, int numBit); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* BITSTREAM_H */ faac-1.28/libfaac/channels.c0000644010307701030770000001325707345217747017414 0ustar fabian-guestfabian-guest/************************* MPEG-2 NBC Audio Decoder ************************** * * "This software module was originally developed in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products.The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works." Copyright(c)1996. * * ****************************************************************************/ /* * $Id: channels.c,v 1.5 2001/09/04 18:39:35 menno Exp $ */ #include "channels.h" #include "coder.h" #include "util.h" /* If LFE present */ /* Num channels # of SCE's # of CPE's #of LFE's */ /* ============ ========== ========== ========= */ /* 1 1 0 0 */ /* 2 0 1 0 */ /* 3 1 1 0 */ /* 4 1 1 1 */ /* 5 1 2 0 */ /* For more than 5 channels, use the following elements: */ /* 2*N 1 2*(N-1) 1 */ /* 2*N+1 1 2*N 0 */ /* */ /* Else: */ /* */ /* Num channels # of SCE's # of CPE's #of LFE's */ /* ============ ========== ========== ========= */ /* 1 1 0 0 */ /* 2 0 1 0 */ /* 3 1 1 0 */ /* 4 2 1 0 */ /* 5 1 2 0 */ /* For more than 5 channels, use the following elements: */ /* 2*N 2 2*(N-1) 0 */ /* 2*N+1 1 2*N 0 */ void GetChannelInfo(ChannelInfo *channelInfo, int numChannels, int useLfe) { int sceTag = 0; int lfeTag = 0; int cpeTag = 0; int numChannelsLeft = numChannels; /* First element is sce, except for 2 channel case */ if (numChannelsLeft != 2) { channelInfo[numChannels-numChannelsLeft].present = 1; channelInfo[numChannels-numChannelsLeft].tag = sceTag++; channelInfo[numChannels-numChannelsLeft].cpe = 0; channelInfo[numChannels-numChannelsLeft].lfe = 0; numChannelsLeft--; } /* Next elements are cpe's */ while (numChannelsLeft > 1) { /* Left channel info */ channelInfo[numChannels-numChannelsLeft].present = 1; channelInfo[numChannels-numChannelsLeft].tag = cpeTag++; channelInfo[numChannels-numChannelsLeft].cpe = 1; channelInfo[numChannels-numChannelsLeft].common_window = 0; channelInfo[numChannels-numChannelsLeft].ch_is_left = 1; channelInfo[numChannels-numChannelsLeft].paired_ch = numChannels-numChannelsLeft+1; channelInfo[numChannels-numChannelsLeft].lfe = 0; numChannelsLeft--; /* Right channel info */ channelInfo[numChannels-numChannelsLeft].present = 1; channelInfo[numChannels-numChannelsLeft].cpe = 1; channelInfo[numChannels-numChannelsLeft].common_window = 0; channelInfo[numChannels-numChannelsLeft].ch_is_left = 0; channelInfo[numChannels-numChannelsLeft].paired_ch = numChannels-numChannelsLeft-1; channelInfo[numChannels-numChannelsLeft].lfe = 0; numChannelsLeft--; } /* Is there another channel left ? */ if (numChannelsLeft) { if (useLfe) { channelInfo[numChannels-numChannelsLeft].present = 1; channelInfo[numChannels-numChannelsLeft].tag = lfeTag++; channelInfo[numChannels-numChannelsLeft].cpe = 0; channelInfo[numChannels-numChannelsLeft].lfe = 1; } else { channelInfo[numChannels-numChannelsLeft].present = 1; channelInfo[numChannels-numChannelsLeft].tag = sceTag++; channelInfo[numChannels-numChannelsLeft].cpe = 0; channelInfo[numChannels-numChannelsLeft].lfe = 0; } numChannelsLeft--; } } faac-1.28/libfaac/channels.h0000644010307701030770000000257607676643515017426 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: channels.h,v 1.7 2003/06/26 19:19:41 knik Exp $ */ #ifndef CHANNEL_H #define CHANNEL_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "coder.h" typedef struct { int is_present; int ms_used[MAX_SCFAC_BANDS]; } MSInfo; typedef struct { int tag; int present; int ch_is_left; int paired_ch; int common_window; int cpe; int sce; int lfe; MSInfo msInfo; } ChannelInfo; void GetChannelInfo(ChannelInfo *channelInfo, int numChannels, int useLfe); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* CHANNEL_H */ faac-1.28/libfaac/coder.h0000644010307701030770000001260210200102766016665 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: coder.h,v 1.13 2005/02/02 07:49:10 sur Exp $ */ #ifndef CODER_H #define CODER_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Allow encoding of Digital Radio Mondiale (DRM) */ //#define DRM /* Allow encoding of Digital Radio Mondiale (DRM) with transform length 1024 */ //#define DRM_1024 #define MAX_CHANNELS 64 #ifdef DRM #ifdef DRM_1024 # define FRAME_LEN 1024 # define BLOCK_LEN_LONG 1024 # define BLOCK_LEN_SHORT 128 #else # define FRAME_LEN 960 # define BLOCK_LEN_LONG 960 # define BLOCK_LEN_SHORT 120 #endif /* DRM_1024 */ #else # define FRAME_LEN 1024 # define BLOCK_LEN_LONG 1024 # define BLOCK_LEN_SHORT 128 #endif #define NSFB_LONG 51 #define NSFB_SHORT 15 #define MAX_SHORT_WINDOWS 8 #define MAX_SCFAC_BANDS ((NSFB_SHORT+1)*MAX_SHORT_WINDOWS) enum WINDOW_TYPE { ONLY_LONG_WINDOW, LONG_SHORT_WINDOW, ONLY_SHORT_WINDOW, SHORT_LONG_WINDOW }; #define TNS_MAX_ORDER 20 #define DEF_TNS_GAIN_THRESH 1.4 #define DEF_TNS_COEFF_THRESH 0.1 #define DEF_TNS_COEFF_RES 4 #define DEF_TNS_RES_OFFSET 3 #define LEN_TNS_NFILTL 2 #define LEN_TNS_NFILTS 1 #define DELAY 2048 #define LEN_LTP_DATA_PRESENT 1 #define LEN_LTP_LAG 11 #define LEN_LTP_COEF 3 #define LEN_LTP_SHORT_USED 1 #define LEN_LTP_SHORT_LAG_PRESENT 1 #define LEN_LTP_SHORT_LAG 5 #define LTP_LAG_OFFSET 16 #define LEN_LTP_LONG_USED 1 #define MAX_LT_PRED_LONG_SFB 40 #define MAX_LT_PRED_SHORT_SFB 13 #define SHORT_SQ_OFFSET (BLOCK_LEN_LONG-(BLOCK_LEN_SHORT*4+BLOCK_LEN_SHORT/2)) #define CODESIZE 8 #define NOK_LT_BLEN (3 * BLOCK_LEN_LONG) #define SBMAX_L 49 #define LPC 2 typedef struct { int order; /* Filter order */ int direction; /* Filtering direction */ int coefCompress; /* Are coeffs compressed? */ int length; /* Length, in bands */ double aCoeffs[TNS_MAX_ORDER+1]; /* AR Coefficients */ double kCoeffs[TNS_MAX_ORDER+1]; /* Reflection Coefficients */ int index[TNS_MAX_ORDER+1]; /* Coefficient indices */ } TnsFilterData; typedef struct { int numFilters; /* Number of filters */ int coefResolution; /* Coefficient resolution */ TnsFilterData tnsFilter[1< #include #include #include "fft.h" #include "util.h" #define MAXLOGM 9 #define MAXLOGR 8 #if defined DRM && !defined DRM_1024 #include "kiss_fft/kiss_fft.h" #include "kiss_fft/kiss_fftr.h" static const int logm_to_nfft[] = { /* 0 1 2 3 */ 0, 0, 0, 0, /* 4 5 6 7 */ 0, 0, 60, 0, /* 8 9 */ 240, 480 }; void fft_initialize( FFT_Tables *fft_tables ) { memset( fft_tables->cfg, 0, sizeof( fft_tables->cfg ) ); } void fft_terminate( FFT_Tables *fft_tables ) { unsigned int i; for ( i = 0; i < sizeof( fft_tables->cfg ) / sizeof( fft_tables->cfg[0] ); i++ ) { if ( fft_tables->cfg[i][0] ) { free( fft_tables->cfg[i][0] ); fft_tables->cfg[i][0] = NULL; } if ( fft_tables->cfg[i][1] ) { free( fft_tables->cfg[i][1] ); fft_tables->cfg[i][1] = NULL; } } } void rfft( FFT_Tables *fft_tables, double *x, int logm ) { #if 0 /* sur: do not use real-only optimized FFT */ double xi[1 << MAXLOGR]; int nfft; if ( logm > MAXLOGR ) { fprintf(stderr, "rfft size too big\n"); exit(1); } nfft = logm_to_nfft[logm]; if ( nfft ) { //unsigned int i; //for ( i = 0; i < nfft; i++ ) //{ // xi[i] = 0.0; //} memset( xi, 0, nfft * sizeof( xi[0] ) ); fft( fft_tables, x, xi, logm ); memcpy( x + nfft / 2, xi, ( nfft / 2 ) * sizeof(x[0]) ); } else { fprintf( stderr, "bad config for logm = %d\n", logm); exit( 1 ); } #else /* sur: use real-only optimized FFT */ int nfft = 0; kiss_fft_scalar fin[1 << MAXLOGR]; kiss_fft_cpx fout[1 << MAXLOGR]; if ( logm > MAXLOGR ) { fprintf(stderr, "fft size too big\n"); exit(1); } nfft = logm_to_nfft[logm]; if ( fft_tables->cfg[logm][0] == NULL ) { if ( nfft ) { fft_tables->cfg[logm][0] = kiss_fftr_alloc( nfft, 0, NULL, NULL ); } else { fprintf(stderr, "bad logm = %d\n", logm); exit( 1 ); } } if ( fft_tables->cfg[logm][0] ) { unsigned int i; for ( i = 0; i < nfft; i++ ) { fin[i] = x[i]; } kiss_fftr( (kiss_fftr_cfg)fft_tables->cfg[logm][0], fin, fout ); for ( i = 0; i < nfft / 2; i++ ) { x[i] = fout[i].r; x[i + nfft / 2] = fout[i].i; } } else { fprintf( stderr, "bad config for logm = %d\n", logm); exit( 1 ); } #endif } void fft( FFT_Tables *fft_tables, double *xr, double *xi, int logm ) { int nfft = 0; kiss_fft_cpx fin[1 << MAXLOGM]; kiss_fft_cpx fout[1 << MAXLOGM]; if ( logm > MAXLOGM ) { fprintf(stderr, "fft size too big\n"); exit(1); } nfft = logm_to_nfft[logm]; if ( fft_tables->cfg[logm][0] == NULL ) { if ( nfft ) { fft_tables->cfg[logm][0] = kiss_fft_alloc( nfft, 0, NULL, NULL ); } else { fprintf(stderr, "bad logm = %d\n", logm); exit( 1 ); } } if ( fft_tables->cfg[logm][0] ) { unsigned int i; for ( i = 0; i < nfft; i++ ) { fin[i].r = xr[i]; fin[i].i = xi[i]; } kiss_fft( (kiss_fft_cfg)fft_tables->cfg[logm][0], fin, fout ); for ( i = 0; i < nfft; i++ ) { xr[i] = fout[i].r; xi[i] = fout[i].i; } } else { fprintf( stderr, "bad config for logm = %d\n", logm); exit( 1 ); } } void ffti( FFT_Tables *fft_tables, double *xr, double *xi, int logm ) { int nfft = 0; kiss_fft_cpx fin[1 << MAXLOGM]; kiss_fft_cpx fout[1 << MAXLOGM]; if ( logm > MAXLOGM ) { fprintf(stderr, "fft size too big\n"); exit(1); } nfft = logm_to_nfft[logm]; if ( fft_tables->cfg[logm][1] == NULL ) { if ( nfft ) { fft_tables->cfg[logm][1] = kiss_fft_alloc( nfft, 1, NULL, NULL ); } else { fprintf(stderr, "bad logm = %d\n", logm); exit( 1 ); } } if ( fft_tables->cfg[logm][1] ) { unsigned int i; double fac = 1.0 / (double)nfft; for ( i = 0; i < nfft; i++ ) { fin[i].r = xr[i]; fin[i].i = xi[i]; } kiss_fft( (kiss_fft_cfg)fft_tables->cfg[logm][1], fin, fout ); for ( i = 0; i < nfft; i++ ) { xr[i] = fout[i].r * fac; xi[i] = fout[i].i * fac; } } else { fprintf( stderr, "bad config for logm = %d\n", logm); exit( 1 ); } } /* sur: Trying to use cfft from libfaad2 -- it does not work 'from scratch' */ // //#include "cfft/common.h" // //void fft_initialize( FFT_Tables *fft_tables ) //{ // memset( fft_tables->cfft, 0, sizeof( fft_tables->cfft ) ); //} //void fft_terminate( FFT_Tables *fft_tables ) //{ // unsigned int i; // for ( i = 0; i < sizeof( fft_tables->cfft ) / sizeof( fft_tables->cfft[0] ); i++ ) // { // if ( fft_tables->cfft[i] ) // { // cfftu( fft_tables->cfft[i] ); // fft_tables->cfft[i] = NULL; // } // } //} // //void rfft( FFT_Tables *fft_tables, double *x, int logm ) //{ // double xi[1 << MAXLOGR]; // // int nfft; // // if ( logm > MAXLOGR ) // { // fprintf(stderr, "rfft size too big\n"); // exit(1); // } // // nfft = logm_to_nfft[logm]; // // if ( nfft ) // { // unsigned int i; // // for ( i = 0; i < nfft; i++ ) // { // xi[i] = 0.0; // } // //memset( xi, 0, nfft * sizeof( xi[0] ) ); // // fft( fft_tables, x, xi, logm ); // // memcpy( x + nfft / 2, xi, ( nfft / 2 ) * sizeof(x[0]) ); // //#ifdef SUR_DEBUG_FFT // { // FILE* f = fopen( "fft.log", "at" ); // // fprintf( f, "RFFT(%d)\n", nfft ); // // for ( i = 0; i < nfft; i++ ) // { // fprintf( f, ";%d;%g;%g\n", i, x[i], xi[i] ); // } // // fclose( f ); // } //#endif // } // else // { // fprintf( stderr, "bad config for logm = %d\n", logm); // exit( 1 ); // } //} // //void fft( FFT_Tables *fft_tables, double *xr, double *xi, int logm ) //{ // int nfft; // // complex_t c[1 << MAXLOGM]; // // if ( logm > MAXLOGM ) // { // fprintf(stderr, "fft size too big\n"); // exit(1); // } // // nfft = logm_to_nfft[logm]; // // if ( fft_tables->cfft[logm] == NULL ) // { // if ( nfft ) // { // fft_tables->cfft[logm] = cffti( nfft ); // } // else // { // fprintf(stderr, "bad logm = %d\n", logm); // exit( 1 ); // } // } // // if ( fft_tables->cfft[logm] ) // { // unsigned int i; // // for ( i = 0; i < nfft; i++ ) // { // RE( c[i] ) = xr[i]; // IM( c[i] ) = xi[i]; // } // // cfftf( fft_tables->cfft[logm], c ); // // for ( i = 0; i < nfft; i++ ) // { // xr[i] = RE( c[i] ); // xi[i] = IM( c[i] ); // } // //#ifdef SUR_DEBUG_FFT // { // FILE* f = fopen( "fft.log", "at" ); // // fprintf( f, "FFT(%d)\n", nfft ); // // for ( i = 0; i < nfft; i++ ) // { // fprintf( f, ";%d;%g;%g\n", i, xr[i], xi[i] ); // } // // fclose( f ); // } //#endif // } // else // { // fprintf( stderr, "bad config for logm = %d\n", logm); // exit( 1 ); // } //} // //void ffti( FFT_Tables *fft_tables, double *xr, double *xi, int logm ) //{ // int nfft; // // complex_t c[1 << MAXLOGM]; // // if ( logm > MAXLOGM ) // { // fprintf(stderr, "fft size too big\n"); // exit(1); // } // // nfft = logm_to_nfft[logm]; // // if ( fft_tables->cfft[logm] == NULL ) // { // if ( nfft ) // { // fft_tables->cfft[logm] = cffti( nfft ); // } // else // { // fprintf(stderr, "bad logm = %d\n", logm); // exit( 1 ); // } // } // // if ( fft_tables->cfft[logm] ) // { // unsigned int i; // // for ( i = 0; i < nfft; i++ ) // { // RE( c[i] ) = xr[i]; // IM( c[i] ) = xi[i]; // } // // cfftb( fft_tables->cfft[logm], c ); // // for ( i = 0; i < nfft; i++ ) // { // xr[i] = RE( c[i] ); // xi[i] = IM( c[i] ); // } // //#ifdef SUR_DEBUG_FFT // { // FILE* f = fopen( "fft.log", "at" ); // // fprintf( f, "FFTI(%d)\n", nfft ); // // for ( i = 0; i < nfft; i++ ) // { // fprintf( f, ";%d;%g;%g\n", i, xr[i], xi[i] ); // } // // fclose( f ); // } //#endif // } // else // { // fprintf( stderr, "bad config for logm = %d\n", logm); // exit( 1 ); // } //} #else /* !defined DRM || defined DRM_1024 */ void fft_initialize( FFT_Tables *fft_tables ) { int i; fft_tables->costbl = AllocMemory( (MAXLOGM+1) * sizeof( fft_tables->costbl[0] ) ); fft_tables->negsintbl = AllocMemory( (MAXLOGM+1) * sizeof( fft_tables->negsintbl[0] ) ); fft_tables->reordertbl = AllocMemory( (MAXLOGM+1) * sizeof( fft_tables->reordertbl[0] ) ); for( i = 0; i< MAXLOGM+1; i++ ) { fft_tables->costbl[i] = NULL; fft_tables->negsintbl[i] = NULL; fft_tables->reordertbl[i] = NULL; } } void fft_terminate( FFT_Tables *fft_tables ) { int i; for( i = 0; i< MAXLOGM+1; i++ ) { if( fft_tables->costbl[i] != NULL ) FreeMemory( fft_tables->costbl[i] ); if( fft_tables->negsintbl[i] != NULL ) FreeMemory( fft_tables->negsintbl[i] ); if( fft_tables->reordertbl[i] != NULL ) FreeMemory( fft_tables->reordertbl[i] ); } FreeMemory( fft_tables->costbl ); FreeMemory( fft_tables->negsintbl ); FreeMemory( fft_tables->reordertbl ); fft_tables->costbl = NULL; fft_tables->negsintbl = NULL; fft_tables->reordertbl = NULL; } static void reorder( FFT_Tables *fft_tables, double *x, int logm) { int i; int size = 1 << logm; unsigned short *r; //size if ( fft_tables->reordertbl[logm] == NULL ) // create bit reversing table { fft_tables->reordertbl[logm] = AllocMemory(size * sizeof(*(fft_tables->reordertbl[0]))); for (i = 0; i < size; i++) { int reversed = 0; int b0; int tmp = i; for (b0 = 0; b0 < logm; b0++) { reversed = (reversed << 1) | (tmp & 1); tmp >>= 1; } fft_tables->reordertbl[logm][i] = reversed; } } r = fft_tables->reordertbl[logm]; for (i = 0; i < size; i++) { int j = r[i]; double tmp; if (j <= i) continue; tmp = x[i]; x[i] = x[j]; x[j] = tmp; } } static void fft_proc( double *xr, double *xi, fftfloat *refac, fftfloat *imfac, int size) { int step, shift, pos; int exp, estep; estep = size; for (step = 1; step < size; step *= 2) { int x1; int x2 = 0; estep >>= 1; for (pos = 0; pos < size; pos += (2 * step)) { x1 = x2; x2 += step; exp = 0; for (shift = 0; shift < step; shift++) { double v2r, v2i; v2r = xr[x2] * refac[exp] - xi[x2] * imfac[exp]; v2i = xr[x2] * imfac[exp] + xi[x2] * refac[exp]; xr[x2] = xr[x1] - v2r; xr[x1] += v2r; xi[x2] = xi[x1] - v2i; xi[x1] += v2i; exp += estep; x1++; x2++; } } } } static void check_tables( FFT_Tables *fft_tables, int logm) { if( fft_tables->costbl[logm] == NULL ) { int i; int size = 1 << logm; if( fft_tables->negsintbl[logm] != NULL ) FreeMemory( fft_tables->negsintbl[logm] ); fft_tables->costbl[logm] = AllocMemory((size / 2) * sizeof(*(fft_tables->costbl[0]))); fft_tables->negsintbl[logm] = AllocMemory((size / 2) * sizeof(*(fft_tables->negsintbl[0]))); for (i = 0; i < (size >> 1); i++) { double theta = 2.0 * M_PI * ((double) i) / (double) size; fft_tables->costbl[logm][i] = cos(theta); fft_tables->negsintbl[logm][i] = -sin(theta); } } } void fft( FFT_Tables *fft_tables, double *xr, double *xi, int logm) { if (logm > MAXLOGM) { fprintf(stderr, "fft size too big\n"); exit(1); } if (logm < 1) { //printf("logm < 1\n"); return; } check_tables( fft_tables, logm); reorder( fft_tables, xr, logm); reorder( fft_tables, xi, logm); fft_proc( xr, xi, fft_tables->costbl[logm], fft_tables->negsintbl[logm], 1 << logm ); } void rfft( FFT_Tables *fft_tables, double *x, int logm) { double xi[1 << MAXLOGR]; if (logm > MAXLOGR) { fprintf(stderr, "rfft size too big\n"); exit(1); } memset(xi, 0, (1 << logm) * sizeof(xi[0])); fft( fft_tables, x, xi, logm); memcpy(x + (1 << (logm - 1)), xi, (1 << (logm - 1)) * sizeof(*x)); } void ffti( FFT_Tables *fft_tables, double *xr, double *xi, int logm) { int i, size; double fac; double *xrp, *xip; fft( fft_tables, xi, xr, logm); size = 1 << logm; fac = 1.0 / size; xrp = xr; xip = xi; for (i = 0; i < size; i++) { *xrp++ *= fac; *xip++ *= fac; } } #endif /* defined DRM && !defined DRM_1024 */ /* $Log: fft.c,v $ Revision 1.12 2005/02/02 07:49:55 sur Added interface to kiss_fft library to implement FFT for 960 transform length. Revision 1.11 2004/04/02 14:56:17 danchr fix name clash w/ libavcodec: fft_init -> fft_initialize bump version number to 1.24 beta Revision 1.10 2003/11/16 05:02:51 stux moved global tables from fft.c into hEncoder FFT_Tables. Add fft_init and fft_terminate, flowed through all necessary changes. This should remove at least one instance of a memory leak, and fix some thread-safety problems. Version update to 1.23.3 Revision 1.9 2003/09/07 16:48:01 knik reduced arrays size Revision 1.8 2002/11/23 17:32:54 knik rfft: made xi a local variable Revision 1.7 2002/08/21 16:52:25 knik new simplier and faster fft routine and correct real fft new real fft is just a complex fft wrapper so it is slower than optimal but by surprise it seems to be at least as fast as the old buggy function */ faac-1.28/libfaac/fft.h0000644010307701030770000000310310200103113016327 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * $Id: fft.h,v 1.6 2005/02/02 07:50:35 sur Exp $ * Copyright (C) 2002 Krzysztof Nikiel * * 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 _FFT_H_ #define _FFT_H_ typedef float fftfloat; #if defined DRM && !defined DRM_1024 #define MAX_FFT 10 typedef struct { /* cfg[Max FFT][FFT and inverse FFT] */ void* cfg[MAX_FFT][2]; } FFT_Tables; #else /* use own FFT */ typedef struct { fftfloat **costbl; fftfloat **negsintbl; unsigned short **reordertbl; } FFT_Tables; #endif /* defined DRM && !defined DRM_1024 */ void fft_initialize ( FFT_Tables *fft_tables ); void fft_terminate ( FFT_Tables *fft_tables ); void rfft ( FFT_Tables *fft_tables, double *x, int logm ); void fft ( FFT_Tables *fft_tables, double *xr, double *xi, int logm ); void ffti ( FFT_Tables *fft_tables, double *xr, double *xi, int logm ); #endif faac-1.28/libfaac/filtbank.c0000644010307701030770000005232310200103160017347 0ustar fabian-guestfabian-guest/************************* MPEG-2 NBC Audio Decoder ************************** * * "This software module was originally developed by AT&T, Dolby Laboratories, Fraunhofer Gesellschaft IIS in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products.The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works." Copyright(c)1996. * * ****************************************************************************/ /* * $Id: filtbank.c,v 1.13 2005/02/02 07:51:12 sur Exp $ */ /* * CHANGES: * 2001/01/17: menno: Added frequency cut off filter. * */ #include #include #include #include "coder.h" #include "filtbank.h" #include "frame.h" #include "fft.h" #include "util.h" #define TWOPI 2*M_PI static void CalculateKBDWindow ( double* win, double alpha, int length ); static double Izero ( double x); static void MDCT ( FFT_Tables *fft_tables, double *data, int N ); static void IMDCT ( FFT_Tables *fft_tables, double *data, int N ); void FilterBankInit(faacEncHandle hEncoder) { unsigned int i, channel; for (channel = 0; channel < hEncoder->numChannels; channel++) { hEncoder->freqBuff[channel] = (double*)AllocMemory(2*FRAME_LEN*sizeof(double)); hEncoder->overlapBuff[channel] = (double*)AllocMemory(FRAME_LEN*sizeof(double)); SetMemory(hEncoder->overlapBuff[channel], 0, FRAME_LEN*sizeof(double)); } hEncoder->sin_window_long = (double*)AllocMemory(BLOCK_LEN_LONG*sizeof(double)); hEncoder->sin_window_short = (double*)AllocMemory(BLOCK_LEN_SHORT*sizeof(double)); hEncoder->kbd_window_long = (double*)AllocMemory(BLOCK_LEN_LONG*sizeof(double)); hEncoder->kbd_window_short = (double*)AllocMemory(BLOCK_LEN_SHORT*sizeof(double)); for( i=0; isin_window_long[i] = sin((M_PI/(2*BLOCK_LEN_LONG)) * (i + 0.5)); for( i=0; isin_window_short[i] = sin((M_PI/(2*BLOCK_LEN_SHORT)) * (i + 0.5)); CalculateKBDWindow(hEncoder->kbd_window_long, 4, BLOCK_LEN_LONG*2); CalculateKBDWindow(hEncoder->kbd_window_short, 6, BLOCK_LEN_SHORT*2); } void FilterBankEnd(faacEncHandle hEncoder) { unsigned int channel; for (channel = 0; channel < hEncoder->numChannels; channel++) { if (hEncoder->freqBuff[channel]) FreeMemory(hEncoder->freqBuff[channel]); if (hEncoder->overlapBuff[channel]) FreeMemory(hEncoder->overlapBuff[channel]); } if (hEncoder->sin_window_long) FreeMemory(hEncoder->sin_window_long); if (hEncoder->sin_window_short) FreeMemory(hEncoder->sin_window_short); if (hEncoder->kbd_window_long) FreeMemory(hEncoder->kbd_window_long); if (hEncoder->kbd_window_short) FreeMemory(hEncoder->kbd_window_short); } void FilterBank(faacEncHandle hEncoder, CoderInfo *coderInfo, double *p_in_data, double *p_out_mdct, double *p_overlap, int overlap_select) { double *p_o_buf, *first_window, *second_window; double *transf_buf; int k, i; int block_type = coderInfo->block_type; transf_buf = (double*)AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); /* create / shift old values */ /* We use p_overlap here as buffer holding the last frame time signal*/ if(overlap_select != MNON_OVERLAPPED) { memcpy(transf_buf, p_overlap, FRAME_LEN*sizeof(double)); memcpy(transf_buf+BLOCK_LEN_LONG, p_in_data, FRAME_LEN*sizeof(double)); memcpy(p_overlap, p_in_data, FRAME_LEN*sizeof(double)); } else { memcpy(transf_buf, p_in_data, 2*FRAME_LEN*sizeof(double)); } /* Window shape processing */ if(overlap_select != MNON_OVERLAPPED) { switch (coderInfo->prev_window_shape) { case SINE_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == LONG_SHORT_WINDOW)) first_window = hEncoder->sin_window_long; else first_window = hEncoder->sin_window_short; break; case KBD_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == LONG_SHORT_WINDOW)) first_window = hEncoder->kbd_window_long; else first_window = hEncoder->kbd_window_short; break; } switch (coderInfo->window_shape){ case SINE_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == SHORT_LONG_WINDOW)) second_window = hEncoder->sin_window_long; else second_window = hEncoder->sin_window_short; break; case KBD_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == SHORT_LONG_WINDOW)) second_window = hEncoder->kbd_window_long; else second_window = hEncoder->kbd_window_short; break; } } else { /* Always long block and sine window for LTP */ first_window = hEncoder->sin_window_long; second_window = hEncoder->sin_window_long; } /* Set ptr to transf-Buffer */ p_o_buf = transf_buf; /* Separate action for each Block Type */ switch (block_type) { case ONLY_LONG_WINDOW : for ( i = 0 ; i < BLOCK_LEN_LONG ; i++){ p_out_mdct[i] = p_o_buf[i] * first_window[i]; p_out_mdct[i+BLOCK_LEN_LONG] = p_o_buf[i+BLOCK_LEN_LONG] * second_window[BLOCK_LEN_LONG-i-1]; } MDCT( &hEncoder->fft_tables, p_out_mdct, 2*BLOCK_LEN_LONG ); break; case LONG_SHORT_WINDOW : for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) p_out_mdct[i] = p_o_buf[i] * first_window[i]; memcpy(p_out_mdct+BLOCK_LEN_LONG,p_o_buf+BLOCK_LEN_LONG,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++) p_out_mdct[i+BLOCK_LEN_LONG+NFLAT_LS] = p_o_buf[i+BLOCK_LEN_LONG+NFLAT_LS] * second_window[BLOCK_LEN_SHORT-i-1]; SetMemory(p_out_mdct+BLOCK_LEN_LONG+NFLAT_LS+BLOCK_LEN_SHORT,0,NFLAT_LS*sizeof(double)); MDCT( &hEncoder->fft_tables, p_out_mdct, 2*BLOCK_LEN_LONG ); break; case SHORT_LONG_WINDOW : SetMemory(p_out_mdct,0,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++) p_out_mdct[i+NFLAT_LS] = p_o_buf[i+NFLAT_LS] * first_window[i]; memcpy(p_out_mdct+NFLAT_LS+BLOCK_LEN_SHORT,p_o_buf+NFLAT_LS+BLOCK_LEN_SHORT,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) p_out_mdct[i+BLOCK_LEN_LONG] = p_o_buf[i+BLOCK_LEN_LONG] * second_window[BLOCK_LEN_LONG-i-1]; MDCT( &hEncoder->fft_tables, p_out_mdct, 2*BLOCK_LEN_LONG ); break; case ONLY_SHORT_WINDOW : p_o_buf += NFLAT_LS; for ( k=0; k < MAX_SHORT_WINDOWS; k++ ) { for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++ ){ p_out_mdct[i] = p_o_buf[i] * first_window[i]; p_out_mdct[i+BLOCK_LEN_SHORT] = p_o_buf[i+BLOCK_LEN_SHORT] * second_window[BLOCK_LEN_SHORT-i-1]; } MDCT( &hEncoder->fft_tables, p_out_mdct, 2*BLOCK_LEN_SHORT ); p_out_mdct += BLOCK_LEN_SHORT; p_o_buf += BLOCK_LEN_SHORT; first_window = second_window; } break; } if (transf_buf) FreeMemory(transf_buf); } void IFilterBank(faacEncHandle hEncoder, CoderInfo *coderInfo, double *p_in_data, double *p_out_data, double *p_overlap, int overlap_select) { double *o_buf, *transf_buf, *overlap_buf; double *first_window, *second_window; double *fp; int k, i; int block_type = coderInfo->block_type; transf_buf = (double*)AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); overlap_buf = (double*)AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); /* Window shape processing */ if (overlap_select != MNON_OVERLAPPED) { // switch (coderInfo->prev_window_shape){ // case SINE_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == LONG_SHORT_WINDOW)) first_window = hEncoder->sin_window_long; else first_window = hEncoder->sin_window_short; // break; // case KBD_WINDOW: // if ( (block_type == ONLY_LONG_WINDOW) || (block_type == LONG_SHORT_WINDOW)) // first_window = hEncoder->kbd_window_long; // else // first_window = hEncoder->kbd_window_short; // break; // } // switch (coderInfo->window_shape){ // case SINE_WINDOW: if ( (block_type == ONLY_LONG_WINDOW) || (block_type == SHORT_LONG_WINDOW)) second_window = hEncoder->sin_window_long; else second_window = hEncoder->sin_window_short; // break; // case KBD_WINDOW: // if ( (block_type == ONLY_LONG_WINDOW) || (block_type == SHORT_LONG_WINDOW)) // second_window = hEncoder->kbd_window_long; // else // second_window = hEncoder->kbd_window_short; // break; // } } else { /* Always long block and sine window for LTP */ first_window = hEncoder->sin_window_long; second_window = hEncoder->sin_window_long; } /* Assemble overlap buffer */ memcpy(overlap_buf,p_overlap,BLOCK_LEN_LONG*sizeof(double)); o_buf = overlap_buf; /* Separate action for each Block Type */ switch( block_type ) { case ONLY_LONG_WINDOW : memcpy(transf_buf, p_in_data,BLOCK_LEN_LONG*sizeof(double)); IMDCT( &hEncoder->fft_tables, transf_buf, 2*BLOCK_LEN_LONG ); for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) transf_buf[i] *= first_window[i]; if (overlap_select != MNON_OVERLAPPED) { for ( i = 0 ; i < BLOCK_LEN_LONG; i++ ){ o_buf[i] += transf_buf[i]; o_buf[i+BLOCK_LEN_LONG] = transf_buf[i+BLOCK_LEN_LONG] * second_window[BLOCK_LEN_LONG-i-1]; } } else { /* overlap_select == NON_OVERLAPPED */ for ( i = 0 ; i < BLOCK_LEN_LONG; i++ ) transf_buf[i+BLOCK_LEN_LONG] *= second_window[BLOCK_LEN_LONG-i-1]; } break; case LONG_SHORT_WINDOW : memcpy(transf_buf, p_in_data,BLOCK_LEN_LONG*sizeof(double)); IMDCT( &hEncoder->fft_tables, transf_buf, 2*BLOCK_LEN_LONG ); for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) transf_buf[i] *= first_window[i]; if (overlap_select != MNON_OVERLAPPED) { for ( i = 0 ; i < BLOCK_LEN_LONG; i++ ) o_buf[i] += transf_buf[i]; memcpy(o_buf+BLOCK_LEN_LONG,transf_buf+BLOCK_LEN_LONG,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++) o_buf[i+BLOCK_LEN_LONG+NFLAT_LS] = transf_buf[i+BLOCK_LEN_LONG+NFLAT_LS] * second_window[BLOCK_LEN_SHORT-i-1]; SetMemory(o_buf+BLOCK_LEN_LONG+NFLAT_LS+BLOCK_LEN_SHORT,0,NFLAT_LS*sizeof(double)); } else { /* overlap_select == NON_OVERLAPPED */ for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++) transf_buf[i+BLOCK_LEN_LONG+NFLAT_LS] *= second_window[BLOCK_LEN_SHORT-i-1]; SetMemory(transf_buf+BLOCK_LEN_LONG+NFLAT_LS+BLOCK_LEN_SHORT,0,NFLAT_LS*sizeof(double)); } break; case SHORT_LONG_WINDOW : memcpy(transf_buf, p_in_data,BLOCK_LEN_LONG*sizeof(double)); IMDCT( &hEncoder->fft_tables, transf_buf, 2*BLOCK_LEN_LONG ); for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++) transf_buf[i+NFLAT_LS] *= first_window[i]; if (overlap_select != MNON_OVERLAPPED) { for ( i = 0 ; i < BLOCK_LEN_SHORT; i++ ) o_buf[i+NFLAT_LS] += transf_buf[i+NFLAT_LS]; memcpy(o_buf+BLOCK_LEN_SHORT+NFLAT_LS,transf_buf+BLOCK_LEN_SHORT+NFLAT_LS,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) o_buf[i+BLOCK_LEN_LONG] = transf_buf[i+BLOCK_LEN_LONG] * second_window[BLOCK_LEN_LONG-i-1]; } else { /* overlap_select == NON_OVERLAPPED */ SetMemory(transf_buf,0,NFLAT_LS*sizeof(double)); for ( i = 0 ; i < BLOCK_LEN_LONG ; i++) transf_buf[i+BLOCK_LEN_LONG] *= second_window[BLOCK_LEN_LONG-i-1]; } break; case ONLY_SHORT_WINDOW : if (overlap_select != MNON_OVERLAPPED) { fp = o_buf + NFLAT_LS; } else { /* overlap_select == NON_OVERLAPPED */ fp = transf_buf; } for ( k=0; k < MAX_SHORT_WINDOWS; k++ ) { memcpy(transf_buf,p_in_data,BLOCK_LEN_SHORT*sizeof(double)); IMDCT( &hEncoder->fft_tables, transf_buf, 2*BLOCK_LEN_SHORT ); p_in_data += BLOCK_LEN_SHORT; if (overlap_select != MNON_OVERLAPPED) { for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++){ transf_buf[i] *= first_window[i]; fp[i] += transf_buf[i]; fp[i+BLOCK_LEN_SHORT] = transf_buf[i+BLOCK_LEN_SHORT] * second_window[BLOCK_LEN_SHORT-i-1]; } fp += BLOCK_LEN_SHORT; } else { /* overlap_select == NON_OVERLAPPED */ for ( i = 0 ; i < BLOCK_LEN_SHORT ; i++){ fp[i] *= first_window[i]; fp[i+BLOCK_LEN_SHORT] *= second_window[BLOCK_LEN_SHORT-i-1]; } fp += 2*BLOCK_LEN_SHORT; } first_window = second_window; } SetMemory(o_buf+BLOCK_LEN_LONG+NFLAT_LS+BLOCK_LEN_SHORT,0,NFLAT_LS*sizeof(double)); break; } if (overlap_select != MNON_OVERLAPPED) memcpy(p_out_data,o_buf,BLOCK_LEN_LONG*sizeof(double)); else /* overlap_select == NON_OVERLAPPED */ memcpy(p_out_data,transf_buf,2*BLOCK_LEN_LONG*sizeof(double)); /* save unused output data */ memcpy(p_overlap,o_buf+BLOCK_LEN_LONG,BLOCK_LEN_LONG*sizeof(double)); if (overlap_buf) FreeMemory(overlap_buf); if (transf_buf) FreeMemory(transf_buf); } void specFilter(double *freqBuff, int sampleRate, int lowpassFreq, int specLen ) { int lowpass,xlowpass; /* calculate the last line which is not zero */ lowpass = (lowpassFreq * specLen) / (sampleRate>>1) + 1; xlowpass = (lowpass < specLen) ? lowpass : specLen ; SetMemory(freqBuff+xlowpass,0,(specLen-xlowpass)*sizeof(double)); } static double Izero(double x) { const double IzeroEPSILON = 1E-41; /* Max error acceptable in Izero */ double sum, u, halfx, temp; int n; sum = u = n = 1; halfx = x/2.0; do { temp = halfx/(double)n; n += 1; temp *= temp; u *= temp; sum += u; } while (u >= IzeroEPSILON*sum); return(sum); } static void CalculateKBDWindow(double* win, double alpha, int length) { int i; double IBeta; double tmp; double sum = 0.0; alpha *= M_PI; IBeta = 1.0/Izero(alpha); /* calculate lower half of Kaiser Bessel window */ for(i=0; i<(length>>1); i++) { tmp = 4.0*(double)i/(double)length - 1.0; win[i] = Izero(alpha*sqrt(1.0-tmp*tmp))*IBeta; sum += win[i]; } sum = 1.0/sum; tmp = 0.0; /* calculate lower half of window */ for(i=0; i<(length>>1); i++) { tmp += win[i]; win[i] = sqrt(tmp*sum); } } static void MDCT( FFT_Tables *fft_tables, double *data, int N ) { double *xi, *xr; double tempr, tempi, c, s, cold, cfreq, sfreq; /* temps for pre and post twiddle */ double freq = TWOPI / N; double cosfreq8, sinfreq8; int i, n; xi = (double*)AllocMemory((N >> 2)*sizeof(double)); xr = (double*)AllocMemory((N >> 2)*sizeof(double)); /* prepare for recurrence relation in pre-twiddle */ cfreq = cos (freq); sfreq = sin (freq); cosfreq8 = cos (freq * 0.125); sinfreq8 = sin (freq * 0.125); c = cosfreq8; s = sinfreq8; for (i = 0; i < (N >> 2); i++) { /* calculate real and imaginary parts of g(n) or G(p) */ n = (N >> 1) - 1 - 2 * i; if (i < (N >> 3)) tempr = data [(N >> 2) + n] + data [N + (N >> 2) - 1 - n]; /* use second form of e(n) for n = N / 2 - 1 - 2i */ else tempr = data [(N >> 2) + n] - data [(N >> 2) - 1 - n]; /* use first form of e(n) for n = N / 2 - 1 - 2i */ n = 2 * i; if (i < (N >> 3)) tempi = data [(N >> 2) + n] - data [(N >> 2) - 1 - n]; /* use first form of e(n) for n=2i */ else tempi = data [(N >> 2) + n] + data [N + (N >> 2) - 1 - n]; /* use second form of e(n) for n=2i*/ /* calculate pre-twiddled FFT input */ xr[i] = tempr * c + tempi * s; xi[i] = tempi * c - tempr * s; /* use recurrence to prepare cosine and sine for next value of i */ cold = c; c = c * cfreq - s * sfreq; s = s * cfreq + cold * sfreq; } /* Perform in-place complex FFT of length N/4 */ switch (N) { case BLOCK_LEN_SHORT * 2: fft( fft_tables, xr, xi, 6); break; case BLOCK_LEN_LONG * 2: fft( fft_tables, xr, xi, 9); } /* prepare for recurrence relations in post-twiddle */ c = cosfreq8; s = sinfreq8; /* post-twiddle FFT output and then get output data */ for (i = 0; i < (N >> 2); i++) { /* get post-twiddled FFT output */ tempr = 2. * (xr[i] * c + xi[i] * s); tempi = 2. * (xi[i] * c - xr[i] * s); /* fill in output values */ data [2 * i] = -tempr; /* first half even */ data [(N >> 1) - 1 - 2 * i] = tempi; /* first half odd */ data [(N >> 1) + 2 * i] = -tempi; /* second half even */ data [N - 1 - 2 * i] = tempr; /* second half odd */ /* use recurrence to prepare cosine and sine for next value of i */ cold = c; c = c * cfreq - s * sfreq; s = s * cfreq + cold * sfreq; } if (xr) FreeMemory(xr); if (xi) FreeMemory(xi); } static void IMDCT( FFT_Tables *fft_tables, double *data, int N) { double *xi, *xr; double tempr, tempi, c, s, cold, cfreq, sfreq; /* temps for pre and post twiddle */ double freq = 2.0 * M_PI / N; double fac, cosfreq8, sinfreq8; int i; xi = (double*)AllocMemory((N >> 2)*sizeof(double)); xr = (double*)AllocMemory((N >> 2)*sizeof(double)); /* Choosing to allocate 2/N factor to Inverse Xform! */ fac = 2. / N; /* remaining 2/N from 4/N IFFT factor */ /* prepare for recurrence relation in pre-twiddle */ cfreq = cos (freq); sfreq = sin (freq); cosfreq8 = cos (freq * 0.125); sinfreq8 = sin (freq * 0.125); c = cosfreq8; s = sinfreq8; for (i = 0; i < (N >> 2); i++) { /* calculate real and imaginary parts of g(n) or G(p) */ tempr = -data[2 * i]; tempi = data[(N >> 1) - 1 - 2 * i]; /* calculate pre-twiddled FFT input */ xr[i] = tempr * c - tempi * s; xi[i] = tempi * c + tempr * s; /* use recurrence to prepare cosine and sine for next value of i */ cold = c; c = c * cfreq - s * sfreq; s = s * cfreq + cold * sfreq; } /* Perform in-place complex IFFT of length N/4 */ switch (N) { case BLOCK_LEN_SHORT * 2: ffti( fft_tables, xr, xi, 6); break; case BLOCK_LEN_LONG * 2: ffti( fft_tables, xr, xi, 9); } /* prepare for recurrence relations in post-twiddle */ c = cosfreq8; s = sinfreq8; /* post-twiddle FFT output and then get output data */ for (i = 0; i < (N >> 2); i++) { /* get post-twiddled FFT output */ tempr = fac * (xr[i] * c - xi[i] * s); tempi = fac * (xi[i] * c + xr[i] * s); /* fill in output values */ data [(N >> 1) + (N >> 2) - 1 - 2 * i] = tempr; if (i < (N >> 3)) data [(N >> 1) + (N >> 2) + 2 * i] = tempr; else data [2 * i - (N >> 2)] = -tempr; data [(N >> 2) + 2 * i] = tempi; if (i < (N >> 3)) data [(N >> 2) - 1 - 2 * i] = -tempi; else data [(N >> 2) + N - 1 - 2*i] = tempi; /* use recurrence to prepare cosine and sine for next value of i */ cold = c; c = c * cfreq - s * sfreq; s = s * cfreq + cold * sfreq; } if (xr) FreeMemory(xr); if (xi) FreeMemory(xi); } faac-1.28/libfaac/filtbank.h0000644010307701030770000000345010200103225017353 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: filtbank.h,v 1.11 2005/02/02 07:51:49 sur Exp $ */ #ifndef FILTBANK_H #define FILTBANK_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "frame.h" #ifdef DRM #define NFLAT_LS (( BLOCK_LEN_LONG - BLOCK_LEN_SHORT ) / 2) #else #define NFLAT_LS 448 #endif #define MOVERLAPPED 0 #define MNON_OVERLAPPED 1 #define SINE_WINDOW 0 #define KBD_WINDOW 1 void FilterBankInit ( faacEncHandle hEncoder ); void FilterBankEnd ( faacEncHandle hEncoder ); void FilterBank( faacEncHandle hEncoder, CoderInfo *coderInfo, double *p_in_data, double *p_out_mdct, double *p_overlap, int overlap_select ); void IFilterBank( faacEncHandle hEncoder, CoderInfo *coderInfo, double *p_in_data, double *p_out_mdct, double *p_overlap, int overlap_select ); void specFilter( double *freqBuff, int sampleRate, int lowpassFreq, int specLen ); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* FILTBANK_H */ faac-1.28/libfaac/frame.c0000644010307701030770000012207110146657576016707 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: frame.c,v 1.67 2004/11/17 14:26:06 menno Exp $ */ /* * CHANGES: * 2001/01/17: menno: Added frequency cut off filter. * 2001/02/28: menno: Added Temporal Noise Shaping. * 2001/03/05: menno: Added Long Term Prediction. * 2001/05/01: menno: Added backward prediction. * */ #include #include #include #include #include "frame.h" #include "coder.h" #include "midside.h" #include "channels.h" #include "bitstream.h" #include "filtbank.h" #include "aacquant.h" #include "util.h" #include "huffman.h" #include "psych.h" #include "tns.h" #include "ltp.h" #include "backpred.h" #include "version.h" #if FAAC_RELEASE static char *libfaacName = FAAC_VERSION; #else static char *libfaacName = FAAC_VERSION ".1 (" __DATE__ ") UNSTABLE"; #endif static char *libCopyright = "FAAC - Freeware Advanced Audio Coder (http://www.audiocoding.com/)\n" " Copyright (C) 1999,2000,2001 Menno Bakker\n" " Copyright (C) 2002,2003 Krzysztof Nikiel\n" "This software is based on the ISO MPEG-4 reference source code.\n"; static const psymodellist_t psymodellist[] = { {&psymodel2, "knipsycho psychoacoustic"}, {NULL} }; static SR_INFO srInfo[12+1]; // base bandwidth for q=100 static const int bwbase = 16000; // bandwidth multiplier (for quantiser) static const int bwmult = 120; // max bandwidth/samplerate ratio static const double bwfac = 0.45; int FAACAPI faacEncGetVersion( char **faac_id_string, char **faac_copyright_string) { if (faac_id_string) *faac_id_string = libfaacName; if (faac_copyright_string) *faac_copyright_string = libCopyright; return FAAC_CFG_VERSION; } int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,unsigned char** ppBuffer,unsigned long* pSizeOfDecoderSpecificInfo) { BitStream* pBitStream = NULL; if((hEncoder == NULL) || (ppBuffer == NULL) || (pSizeOfDecoderSpecificInfo == NULL)) { return -1; } if(hEncoder->config.mpegVersion == MPEG2){ return -2; /* not supported */ } *pSizeOfDecoderSpecificInfo = 2; *ppBuffer = malloc(2); if(*ppBuffer != NULL){ memset(*ppBuffer,0,*pSizeOfDecoderSpecificInfo); pBitStream = OpenBitStream(*pSizeOfDecoderSpecificInfo, *ppBuffer); PutBit(pBitStream, hEncoder->config.aacObjectType, 5); PutBit(pBitStream, hEncoder->sampleRateIdx, 4); PutBit(pBitStream, hEncoder->numChannels, 4); CloseBitStream(pBitStream); return 0; } else { return -3; } } faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder) { faacEncConfigurationPtr config = &(hEncoder->config); return config; } int FAACAPI faacEncSetConfiguration(faacEncHandle hEncoder, faacEncConfigurationPtr config) { int i; hEncoder->config.allowMidside = config->allowMidside; hEncoder->config.useLfe = config->useLfe; hEncoder->config.useTns = config->useTns; hEncoder->config.aacObjectType = config->aacObjectType; hEncoder->config.mpegVersion = config->mpegVersion; hEncoder->config.outputFormat = config->outputFormat; hEncoder->config.inputFormat = config->inputFormat; hEncoder->config.shortctl = config->shortctl; assert((hEncoder->config.outputFormat == 0) || (hEncoder->config.outputFormat == 1)); switch( hEncoder->config.inputFormat ) { case FAAC_INPUT_16BIT: //case FAAC_INPUT_24BIT: case FAAC_INPUT_32BIT: case FAAC_INPUT_FLOAT: break; default: return 0; break; } /* No SSR supported for now */ if (hEncoder->config.aacObjectType == SSR) return 0; /* LTP only with MPEG4 */ if ((hEncoder->config.aacObjectType == LTP) && (hEncoder->config.mpegVersion != MPEG4)) return 0; /* Re-init TNS for new profile */ TnsInit(hEncoder); /* Check for correct bitrate */ if (config->bitRate > MaxBitrate(hEncoder->sampleRate)) return 0; #if 0 if (config->bitRate < MinBitrate()) return 0; #endif if (config->bitRate && !config->bandWidth) { static struct { int rate; // per channel at 44100 sampling frequency int cutoff; } rates[] = { #ifdef DRM /* DRM uses low bit-rates. We've chosen higher bandwidth values and decrease the quantizer quality at the same time to preserve the low bit-rate */ {4500, 1200}, {9180, 2500}, {11640, 3000}, {14500, 4000}, {17460, 5500}, {20960, 6250}, {40000, 12000}, #else {29500, 5000}, {37500, 7000}, {47000, 10000}, {64000, 16000}, {76000, 20000}, #endif {0, 0} }; int f0, f1; int r0, r1; #ifdef DRM double tmpbitRate = (double)config->bitRate; #else double tmpbitRate = (double)config->bitRate * 44100 / hEncoder->sampleRate; #endif config->quantqual = 100; f0 = f1 = rates[0].cutoff; r0 = r1 = rates[0].rate; for (i = 0; rates[i].rate; i++) { f0 = f1; f1 = rates[i].cutoff; r0 = r1; r1 = rates[i].rate; if (rates[i].rate >= tmpbitRate) break; } if (tmpbitRate > r1) tmpbitRate = r1; if (tmpbitRate < r0) tmpbitRate = r0; if (f1 > f0) config->bandWidth = pow((double)tmpbitRate / r1, log((double)f1 / f0) / log ((double)r1 / r0)) * (double)f1; else config->bandWidth = f1; #ifndef DRM config->bandWidth = (double)config->bandWidth * hEncoder->sampleRate / 44100; config->bitRate = tmpbitRate * hEncoder->sampleRate / 44100; #endif if (config->bandWidth > bwbase) config->bandWidth = bwbase; } hEncoder->config.bitRate = config->bitRate; if (!config->bandWidth) { config->bandWidth = (config->quantqual - 100) * bwmult + bwbase; } hEncoder->config.bandWidth = config->bandWidth; // check bandwidth if (hEncoder->config.bandWidth < 100) hEncoder->config.bandWidth = 100; if (hEncoder->config.bandWidth > (hEncoder->sampleRate / 2)) hEncoder->config.bandWidth = hEncoder->sampleRate / 2; if (config->quantqual > 500) config->quantqual = 500; if (config->quantqual < 10) config->quantqual = 10; hEncoder->config.quantqual = config->quantqual; /* set quantization quality */ hEncoder->aacquantCfg.quality = config->quantqual; // reset psymodel hEncoder->psymodel->PsyEnd(&hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->numChannels); if (config->psymodelidx >= (sizeof(psymodellist) / sizeof(psymodellist[0]) - 1)) config->psymodelidx = (sizeof(psymodellist) / sizeof(psymodellist[0])) - 2; hEncoder->config.psymodelidx = config->psymodelidx; hEncoder->psymodel = psymodellist[hEncoder->config.psymodelidx].model; hEncoder->psymodel->PsyInit(&hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->numChannels, hEncoder->sampleRate, hEncoder->srInfo->cb_width_long, hEncoder->srInfo->num_cb_long, hEncoder->srInfo->cb_width_short, hEncoder->srInfo->num_cb_short); /* load channel_map */ for( i = 0; i < 64; i++ ) hEncoder->config.channel_map[i] = config->channel_map[i]; /* OK */ return 1; } faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate, unsigned int numChannels, unsigned long *inputSamples, unsigned long *maxOutputBytes) { unsigned int channel; faacEncHandle hEncoder; *inputSamples = FRAME_LEN*numChannels; *maxOutputBytes = (6144/8)*numChannels; #ifdef DRM *maxOutputBytes += 1; /* for CRC */ #endif hEncoder = (faacEncStruct*)AllocMemory(sizeof(faacEncStruct)); SetMemory(hEncoder, 0, sizeof(faacEncStruct)); hEncoder->numChannels = numChannels; hEncoder->sampleRate = sampleRate; hEncoder->sampleRateIdx = GetSRIndex(sampleRate); /* Initialize variables to default values */ hEncoder->frameNum = 0; hEncoder->flushFrame = 0; /* Default configuration */ hEncoder->config.version = FAAC_CFG_VERSION; hEncoder->config.name = libfaacName; hEncoder->config.copyright = libCopyright; hEncoder->config.mpegVersion = MPEG4; hEncoder->config.aacObjectType = LTP; hEncoder->config.allowMidside = 1; hEncoder->config.useLfe = 1; hEncoder->config.useTns = 0; hEncoder->config.bitRate = 0; /* default bitrate / channel */ hEncoder->config.bandWidth = bwfac * hEncoder->sampleRate; if (hEncoder->config.bandWidth > bwbase) hEncoder->config.bandWidth = bwbase; hEncoder->config.quantqual = 100; hEncoder->config.psymodellist = (psymodellist_t *)psymodellist; hEncoder->config.psymodelidx = 0; hEncoder->psymodel = hEncoder->config.psymodellist[hEncoder->config.psymodelidx].model; hEncoder->config.shortctl = SHORTCTL_NORMAL; /* default channel map is straight-through */ for( channel = 0; channel < 64; channel++ ) hEncoder->config.channel_map[channel] = channel; /* by default we have to be compatible with all previous software which assumes that we will generate ADTS /AV */ hEncoder->config.outputFormat = 1; /* be compatible with software which assumes 24bit in 32bit PCM */ hEncoder->config.inputFormat = FAAC_INPUT_32BIT; /* find correct sampling rate depending parameters */ hEncoder->srInfo = &srInfo[hEncoder->sampleRateIdx]; for (channel = 0; channel < numChannels; channel++) { hEncoder->coderInfo[channel].prev_window_shape = SINE_WINDOW; hEncoder->coderInfo[channel].window_shape = SINE_WINDOW; hEncoder->coderInfo[channel].block_type = ONLY_LONG_WINDOW; hEncoder->coderInfo[channel].num_window_groups = 1; hEncoder->coderInfo[channel].window_group_length[0] = 1; /* FIXME: Use sr_idx here */ hEncoder->coderInfo[channel].max_pred_sfb = GetMaxPredSfb(hEncoder->sampleRateIdx); hEncoder->sampleBuff[channel] = NULL; hEncoder->nextSampleBuff[channel] = NULL; hEncoder->next2SampleBuff[channel] = NULL; hEncoder->ltpTimeBuff[channel] = (double*)AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); SetMemory(hEncoder->ltpTimeBuff[channel], 0, 2*BLOCK_LEN_LONG*sizeof(double)); } /* Initialize coder functions */ fft_initialize( &hEncoder->fft_tables ); hEncoder->psymodel->PsyInit(&hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->numChannels, hEncoder->sampleRate, hEncoder->srInfo->cb_width_long, hEncoder->srInfo->num_cb_long, hEncoder->srInfo->cb_width_short, hEncoder->srInfo->num_cb_short); FilterBankInit(hEncoder); TnsInit(hEncoder); LtpInit(hEncoder); PredInit(hEncoder); AACQuantizeInit(hEncoder->coderInfo, hEncoder->numChannels, &(hEncoder->aacquantCfg)); HuffmanInit(hEncoder->coderInfo, hEncoder->numChannels); /* Return handle */ return hEncoder; } int FAACAPI faacEncClose(faacEncHandle hEncoder) { unsigned int channel; /* Deinitialize coder functions */ hEncoder->psymodel->PsyEnd(&hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->numChannels); FilterBankEnd(hEncoder); LtpEnd(hEncoder); AACQuantizeEnd(hEncoder->coderInfo, hEncoder->numChannels, &(hEncoder->aacquantCfg)); HuffmanEnd(hEncoder->coderInfo, hEncoder->numChannels); fft_terminate( &hEncoder->fft_tables ); /* Free remaining buffer memory */ for (channel = 0; channel < hEncoder->numChannels; channel++) { if (hEncoder->ltpTimeBuff[channel]) FreeMemory(hEncoder->ltpTimeBuff[channel]); if (hEncoder->sampleBuff[channel]) FreeMemory(hEncoder->sampleBuff[channel]); if (hEncoder->nextSampleBuff[channel]) FreeMemory(hEncoder->nextSampleBuff[channel]); if (hEncoder->next2SampleBuff[channel]) FreeMemory (hEncoder->next2SampleBuff[channel]); if (hEncoder->next3SampleBuff[channel]) FreeMemory (hEncoder->next3SampleBuff[channel]); } /* Free handle */ if (hEncoder) FreeMemory(hEncoder); return 0; } int FAACAPI faacEncEncode(faacEncHandle hEncoder, int32_t *inputBuffer, unsigned int samplesInput, unsigned char *outputBuffer, unsigned int bufferSize ) { unsigned int channel, i; int sb, frameBytes; unsigned int offset; BitStream *bitStream; /* bitstream used for writing the frame to */ TnsInfo *tnsInfo_for_LTP; TnsInfo *tnsDecInfo; #ifdef DRM int desbits, diff; double fix; #endif /* local copy's of parameters */ ChannelInfo *channelInfo = hEncoder->channelInfo; CoderInfo *coderInfo = hEncoder->coderInfo; unsigned int numChannels = hEncoder->numChannels; unsigned int sampleRate = hEncoder->sampleRate; unsigned int aacObjectType = hEncoder->config.aacObjectType; unsigned int mpegVersion = hEncoder->config.mpegVersion; unsigned int useLfe = hEncoder->config.useLfe; unsigned int useTns = hEncoder->config.useTns; unsigned int allowMidside = hEncoder->config.allowMidside; unsigned int bandWidth = hEncoder->config.bandWidth; unsigned int shortctl = hEncoder->config.shortctl; /* Increase frame number */ hEncoder->frameNum++; if (samplesInput == 0) hEncoder->flushFrame++; /* After 4 flush frames all samples have been encoded, return 0 bytes written */ if (hEncoder->flushFrame > 4) return 0; /* Determine the channel configuration */ GetChannelInfo(channelInfo, numChannels, useLfe); /* Update current sample buffers */ for (channel = 0; channel < numChannels; channel++) { double *tmp; if (hEncoder->sampleBuff[channel]) { for(i = 0; i < FRAME_LEN; i++) { hEncoder->ltpTimeBuff[channel][i] = hEncoder->sampleBuff[channel][i]; } } if (hEncoder->nextSampleBuff[channel]) { for(i = 0; i < FRAME_LEN; i++) { hEncoder->ltpTimeBuff[channel][FRAME_LEN + i] = hEncoder->nextSampleBuff[channel][i]; } } if (!hEncoder->sampleBuff[channel]) hEncoder->sampleBuff[channel] = (double*)AllocMemory(FRAME_LEN*sizeof(double)); tmp = hEncoder->sampleBuff[channel]; hEncoder->sampleBuff[channel] = hEncoder->nextSampleBuff[channel]; hEncoder->nextSampleBuff[channel] = hEncoder->next2SampleBuff[channel]; hEncoder->next2SampleBuff[channel] = hEncoder->next3SampleBuff[channel]; hEncoder->next3SampleBuff[channel] = tmp; if (samplesInput == 0) { /* start flushing*/ for (i = 0; i < FRAME_LEN; i++) hEncoder->next3SampleBuff[channel][i] = 0.0; } else { int samples_per_channel = samplesInput/numChannels; /* handle the various input formats and channel remapping */ switch( hEncoder->config.inputFormat ) { case FAAC_INPUT_16BIT: { short *input_channel = (short*)inputBuffer + hEncoder->config.channel_map[channel]; for (i = 0; i < samples_per_channel; i++) { hEncoder->next3SampleBuff[channel][i] = (double)*input_channel; input_channel += numChannels; } } break; case FAAC_INPUT_32BIT: { int32_t *input_channel = (int32_t*)inputBuffer + hEncoder->config.channel_map[channel]; for (i = 0; i < samples_per_channel; i++) { hEncoder->next3SampleBuff[channel][i] = (1.0/256) * (double)*input_channel; input_channel += numChannels; } } break; case FAAC_INPUT_FLOAT: { float *input_channel = (float*)inputBuffer + hEncoder->config.channel_map[channel]; for (i = 0; i < samples_per_channel; i++) { hEncoder->next3SampleBuff[channel][i] = (double)*input_channel; input_channel += numChannels; } } break; default: return -1; /* invalid input format */ break; } for (i = (int)(samplesInput/numChannels); i < FRAME_LEN; i++) hEncoder->next3SampleBuff[channel][i] = 0.0; } /* Psychoacoustics */ /* Update buffers and run FFT on new samples */ /* LFE psychoacoustic can run without it */ if (!channelInfo[channel].lfe || channelInfo[channel].cpe) { hEncoder->psymodel->PsyBufferUpdate( &hEncoder->fft_tables, &hEncoder->gpsyInfo, &hEncoder->psyInfo[channel], hEncoder->next3SampleBuff[channel], bandWidth, hEncoder->srInfo->cb_width_short, hEncoder->srInfo->num_cb_short); } } if (hEncoder->frameNum <= 3) /* Still filling up the buffers */ return 0; /* Psychoacoustics */ hEncoder->psymodel->PsyCalculate(channelInfo, &hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->srInfo->cb_width_long, hEncoder->srInfo->num_cb_long, hEncoder->srInfo->cb_width_short, hEncoder->srInfo->num_cb_short, numChannels); hEncoder->psymodel->BlockSwitch(coderInfo, hEncoder->psyInfo, numChannels); /* force block type */ if (shortctl == SHORTCTL_NOSHORT) { for (channel = 0; channel < numChannels; channel++) { coderInfo[channel].block_type = ONLY_LONG_WINDOW; } } if (shortctl == SHORTCTL_NOLONG) { for (channel = 0; channel < numChannels; channel++) { coderInfo[channel].block_type = ONLY_SHORT_WINDOW; } } /* AAC Filterbank, MDCT with overlap and add */ for (channel = 0; channel < numChannels; channel++) { int k; FilterBank(hEncoder, &coderInfo[channel], hEncoder->sampleBuff[channel], hEncoder->freqBuff[channel], hEncoder->overlapBuff[channel], MOVERLAPPED); if (coderInfo[channel].block_type == ONLY_SHORT_WINDOW) { for (k = 0; k < 8; k++) { specFilter(hEncoder->freqBuff[channel]+k*BLOCK_LEN_SHORT, sampleRate, bandWidth, BLOCK_LEN_SHORT); } } else { specFilter(hEncoder->freqBuff[channel], sampleRate, bandWidth, BLOCK_LEN_LONG); } } /* TMP: Build sfb offset table and other stuff */ for (channel = 0; channel < numChannels; channel++) { channelInfo[channel].msInfo.is_present = 0; if (coderInfo[channel].block_type == ONLY_SHORT_WINDOW) { coderInfo[channel].max_sfb = hEncoder->srInfo->num_cb_short; coderInfo[channel].nr_of_sfb = hEncoder->srInfo->num_cb_short; coderInfo[channel].num_window_groups = 1; coderInfo[channel].window_group_length[0] = 8; coderInfo[channel].window_group_length[1] = 0; coderInfo[channel].window_group_length[2] = 0; coderInfo[channel].window_group_length[3] = 0; coderInfo[channel].window_group_length[4] = 0; coderInfo[channel].window_group_length[5] = 0; coderInfo[channel].window_group_length[6] = 0; coderInfo[channel].window_group_length[7] = 0; offset = 0; for (sb = 0; sb < coderInfo[channel].nr_of_sfb; sb++) { coderInfo[channel].sfb_offset[sb] = offset; offset += hEncoder->srInfo->cb_width_short[sb]; } coderInfo[channel].sfb_offset[coderInfo[channel].nr_of_sfb] = offset; } else { coderInfo[channel].max_sfb = hEncoder->srInfo->num_cb_long; coderInfo[channel].nr_of_sfb = hEncoder->srInfo->num_cb_long; coderInfo[channel].num_window_groups = 1; coderInfo[channel].window_group_length[0] = 1; offset = 0; for (sb = 0; sb < coderInfo[channel].nr_of_sfb; sb++) { coderInfo[channel].sfb_offset[sb] = offset; offset += hEncoder->srInfo->cb_width_long[sb]; } coderInfo[channel].sfb_offset[coderInfo[channel].nr_of_sfb] = offset; } } /* Perform TNS analysis and filtering */ for (channel = 0; channel < numChannels; channel++) { if ((!channelInfo[channel].lfe) && (useTns)) { TnsEncode(&(coderInfo[channel].tnsInfo), coderInfo[channel].max_sfb, coderInfo[channel].max_sfb, coderInfo[channel].block_type, coderInfo[channel].sfb_offset, hEncoder->freqBuff[channel]); } else { coderInfo[channel].tnsInfo.tnsDataPresent = 0; /* TNS not used for LFE */ } } for(channel = 0; channel < numChannels; channel++) { if((coderInfo[channel].tnsInfo.tnsDataPresent != 0) && (useTns)) tnsInfo_for_LTP = &(coderInfo[channel].tnsInfo); else tnsInfo_for_LTP = NULL; if(channelInfo[channel].present && (!channelInfo[channel].lfe) && (coderInfo[channel].block_type != ONLY_SHORT_WINDOW) && (mpegVersion == MPEG4) && (aacObjectType == LTP)) { LtpEncode(hEncoder, &coderInfo[channel], &(coderInfo[channel].ltpInfo), tnsInfo_for_LTP, hEncoder->freqBuff[channel], hEncoder->ltpTimeBuff[channel]); } else { coderInfo[channel].ltpInfo.global_pred_flag = 0; } } for(channel = 0; channel < numChannels; channel++) { if ((aacObjectType == MAIN) && (!channelInfo[channel].lfe)) { int numPredBands = min(coderInfo[channel].max_pred_sfb, coderInfo[channel].nr_of_sfb); PredCalcPrediction(hEncoder->freqBuff[channel], coderInfo[channel].requantFreq, coderInfo[channel].block_type, numPredBands, (coderInfo[channel].block_type==ONLY_SHORT_WINDOW)? hEncoder->srInfo->cb_width_short:hEncoder->srInfo->cb_width_long, coderInfo, channelInfo, channel); } else { coderInfo[channel].pred_global_flag = 0; } } for (channel = 0; channel < numChannels; channel++) { if (coderInfo[channel].block_type == ONLY_SHORT_WINDOW) { SortForGrouping(&coderInfo[channel], &hEncoder->psyInfo[channel], &channelInfo[channel], hEncoder->srInfo->cb_width_short, hEncoder->freqBuff[channel]); } CalcAvgEnrg(&coderInfo[channel], hEncoder->freqBuff[channel]); // reduce LFE bandwidth if (!channelInfo[channel].cpe && channelInfo[channel].lfe) { coderInfo[channel].nr_of_sfb = coderInfo[channel].max_sfb = 3; } } MSEncode(coderInfo, channelInfo, hEncoder->freqBuff, numChannels, allowMidside); for (channel = 0; channel < numChannels; channel++) { CalcAvgEnrg(&coderInfo[channel], hEncoder->freqBuff[channel]); } #ifdef DRM /* loop the quantization until the desired bit-rate is reached */ diff = 1; /* to enter while loop */ hEncoder->aacquantCfg.quality = 120; /* init quality setting */ while (diff > 0) { /* if too many bits, do it again */ #endif /* Quantize and code the signal */ for (channel = 0; channel < numChannels; channel++) { if (coderInfo[channel].block_type == ONLY_SHORT_WINDOW) { AACQuantize(&coderInfo[channel], &hEncoder->psyInfo[channel], &channelInfo[channel], hEncoder->srInfo->cb_width_short, hEncoder->srInfo->num_cb_short, hEncoder->freqBuff[channel], &(hEncoder->aacquantCfg)); } else { AACQuantize(&coderInfo[channel], &hEncoder->psyInfo[channel], &channelInfo[channel], hEncoder->srInfo->cb_width_long, hEncoder->srInfo->num_cb_long, hEncoder->freqBuff[channel], &(hEncoder->aacquantCfg)); } } #ifdef DRM /* Write the AAC bitstream */ bitStream = OpenBitStream(bufferSize, outputBuffer); WriteBitstream(hEncoder, coderInfo, channelInfo, bitStream, numChannels); /* Close the bitstream and return the number of bytes written */ frameBytes = CloseBitStream(bitStream); /* now calculate desired bits and compare with actual encoded bits */ desbits = (int) ((double) numChannels * (hEncoder->config.bitRate * FRAME_LEN) / hEncoder->sampleRate); diff = ((frameBytes - 1 /* CRC */) * 8) - desbits; /* do linear correction according to relative difference */ fix = (double) desbits / ((frameBytes - 1 /* CRC */) * 8); /* speed up convergence. A value of 0.92 gives approx up to 10 iterations */ if (fix > 0.92) fix = 0.92; hEncoder->aacquantCfg.quality *= fix; /* quality should not go lower than 1, set diff to exit loop */ if (hEncoder->aacquantCfg.quality <= 1) diff = -1; } #endif // fix max_sfb in CPE mode for (channel = 0; channel < numChannels; channel++) { if (channelInfo[channel].present && (channelInfo[channel].cpe) && (channelInfo[channel].ch_is_left)) { CoderInfo *cil, *cir; cil = &coderInfo[channel]; cir = &coderInfo[channelInfo[channel].paired_ch]; cil->max_sfb = cir->max_sfb = max(cil->max_sfb, cir->max_sfb); cil->nr_of_sfb = cir->nr_of_sfb = cil->max_sfb; } } MSReconstruct(coderInfo, channelInfo, numChannels); for (channel = 0; channel < numChannels; channel++) { /* If short window, reconstruction not needed for prediction */ if ((coderInfo[channel].block_type == ONLY_SHORT_WINDOW)) { int sind; for (sind = 0; sind < BLOCK_LEN_LONG; sind++) { coderInfo[channel].requantFreq[sind] = 0.0; } } else { if((coderInfo[channel].tnsInfo.tnsDataPresent != 0) && (useTns)) tnsDecInfo = &(coderInfo[channel].tnsInfo); else tnsDecInfo = NULL; if ((!channelInfo[channel].lfe) && (aacObjectType == LTP)) { /* no reconstruction needed for LFE channel*/ LtpReconstruct(&coderInfo[channel], &(coderInfo[channel].ltpInfo), coderInfo[channel].requantFreq); if(tnsDecInfo != NULL) TnsDecodeFilterOnly(&(coderInfo[channel].tnsInfo), coderInfo[channel].nr_of_sfb, coderInfo[channel].max_sfb, coderInfo[channel].block_type, coderInfo[channel].sfb_offset, coderInfo[channel].requantFreq); IFilterBank(hEncoder, &coderInfo[channel], coderInfo[channel].requantFreq, coderInfo[channel].ltpInfo.time_buffer, coderInfo[channel].ltpInfo.ltp_overlap_buffer, MOVERLAPPED); LtpUpdate(&(coderInfo[channel].ltpInfo), coderInfo[channel].ltpInfo.time_buffer, coderInfo[channel].ltpInfo.ltp_overlap_buffer, BLOCK_LEN_LONG); } } } #ifndef DRM /* Write the AAC bitstream */ bitStream = OpenBitStream(bufferSize, outputBuffer); WriteBitstream(hEncoder, coderInfo, channelInfo, bitStream, numChannels); /* Close the bitstream and return the number of bytes written */ frameBytes = CloseBitStream(bitStream); /* Adjust quality to get correct average bitrate */ if (hEncoder->config.bitRate) { double fix; int desbits = numChannels * (hEncoder->config.bitRate * FRAME_LEN) / hEncoder->sampleRate; int diff = (frameBytes * 8) - desbits; hEncoder->bitDiff += diff; fix = (double)hEncoder->bitDiff / desbits; fix *= 0.01; fix = max(fix, -0.2); fix = min(fix, 0.2); if (((diff > 0) && (fix > 0.0)) || ((diff < 0) && (fix < 0.0))) { hEncoder->aacquantCfg.quality *= (1.0 - fix); if (hEncoder->aacquantCfg.quality > 300) hEncoder->aacquantCfg.quality = 300; if (hEncoder->aacquantCfg.quality < 50) hEncoder->aacquantCfg.quality = 50; } } #endif return frameBytes; } #ifdef DRM /* Scalefactorband data table for 960 transform length */ /* all parameters which are different from the 1024 transform length table are marked with an "x" */ static SR_INFO srInfo[12+1] = { { 96000, 40/*x*/, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0/*x*/ },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 28/*x*/ } }, { 88200, 40/*x*/, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0/*x*/ },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 28/*x*/ } }, { 64000, 45/*x*/, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 24, 24, 28, 36, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 16/*x*/, 0/*x*/ },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 28/*x*/ } }, { 48000, 49, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32/*x*/ }, { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 8/*x*/ } }, { 44100, 49, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32/*x*/ }, { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 8/*x*/ } }, { 32000, 49/*x*/, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0/*x*/, 0/*x*/ },{ 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 } }, { 24000, 46/*x*/, 15, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 0/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 12/*x*/ } }, { 22050, 46/*x*/, 15, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 0/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 12/*x*/ } }, { 16000, 42/*x*/, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 0/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 12/*x*/ } }, { 12000, 42/*x*/, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 0/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 12/*x*/ } }, { 11025, 42/*x*/, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 0/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 12/*x*/ } }, { 8000, 40, 15, { 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 16/*x*/ }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 12/*x*/ } }, { -1 } }; #else /* Scalefactorband data table for 1024 transform length */ static SR_INFO srInfo[12+1] = { { 96000, 41, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36 } }, { 88200, 41, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36 } }, { 64000, 47, 12, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 24, 24, 28, 36, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },{ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 32 } }, { 48000, 49, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96 }, { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 } }, { 44100, 49, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96 }, { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 } }, { 32000, 51, 14, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 },{ 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 } }, { 24000, 47, 15, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64 }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20 } }, { 22050, 47, 15, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64 }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20 } }, { 16000, 43, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64 }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20 } }, { 12000, 43, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64 }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20 } }, { 11025, 43, 15, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64 }, { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20 } }, { 8000, 40, 15, { 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80 }, { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20 } }, { -1 } }; #endif /* $Log: frame.c,v $ Revision 1.67 2004/11/17 14:26:06 menno Infinite loop fix dunno if this is good, encoder might be tuned to use energies from before MS encoding. But since the MS encoded samples are used in quantisation this might actually be better. Please test. Revision 1.66 2004/11/04 12:51:09 aforanna version number updated to 1.24.1 due to changes in Winamp and CoolEdit plugins Revision 1.65 2004/07/18 09:34:24 corrados New bandwidth settings for DRM, improved quantization quality adaptation (almost constant bit-rate now) Revision 1.64 2004/07/13 17:56:37 corrados bug fix with new object type definitions Revision 1.63 2004/07/08 14:01:25 corrados New scalefactorband table for 960 transform length, bug fix in HCR Revision 1.62 2004/07/04 12:10:52 corrados made faac compliant with Digital Radio Mondiale (DRM) (DRM macro must be set) implemented HCR tool, VCB11, CRC, scalable bitstream order note: VCB11 only uses codebook 11! TODO: implement codebooks 16-32 960 transform length is not yet implemented (TODO)! Use 1024 for encoding and 960 for decoding, resulting in a lot of artefacts Revision 1.61 2004/05/03 11:37:16 danchr bump version to unstable 1.24+ Revision 1.60 2004/04/13 13:47:33 danchr clarify release <> unstable status Revision 1.59 2004/04/02 14:56:17 danchr fix name clash w/ libavcodec: fft_init -> fft_initialize bump version number to 1.24 beta Revision 1.58 2004/03/17 13:34:20 danchr Automatic, untuned setting of lowpass for VBR. Revision 1.57 2004/03/15 20:16:42 knik fixed copyright notice Revision 1.56 2004/01/23 10:22:26 stux *** empty log message *** Revision 1.55 2003/12/17 20:59:55 knik changed default cutoff to 16k Revision 1.54 2003/11/24 18:09:12 knik A safe version of faacEncGetVersion() without string length problem. Removed Stux from copyright notice. I don't think he contributed something very substantial to faac and this is not the right place to list all contributors. Revision 1.53 2003/11/16 05:02:52 stux moved global tables from fft.c into hEncoder FFT_Tables. Add fft_init and fft_terminate, flowed through all necessary changes. This should remove at least one instance of a memory leak, and fix some thread-safety problems. Version update to 1.23.3 Revision 1.52 2003/11/15 08:13:42 stux added FaacEncGetVersion(), version 1.23.2, added myself to faacCopyright :-P, does vanity know no bound ;) Revision 1.51 2003/11/10 17:48:00 knik Allowed independent bitRate and bandWidth setting. Small fixes. Revision 1.50 2003/10/29 10:31:25 stux Added channel_map to FaacEncHandle, facilitates free generalised channel remapping in the faac core. Default is straight-through, should be *zero* performance hit... and even probably an immeasurable performance gain, updated FAAC_CFG_VERSION to 104 and FAAC_VERSION to 1.22.0 Revision 1.49 2003/10/12 16:43:39 knik average bitrate control made more stable Revision 1.48 2003/10/12 14:29:53 knik more accurate average bitrate control Revision 1.47 2003/09/24 16:26:54 knik faacEncStruct: quantizer specific data enclosed in AACQuantCfg structure. Added config option to enforce block type. Revision 1.46 2003/09/07 16:48:31 knik Updated psymodel call. Updated bitrate/cutoff mapping table. Revision 1.45 2003/08/23 15:02:13 knik last frame moved back to the library Revision 1.44 2003/08/15 11:42:08 knik removed single silent flush frame Revision 1.43 2003/08/11 09:43:47 menno thread safety, some tables added to the encoder context Revision 1.42 2003/08/09 11:39:30 knik LFE support enabled by default Revision 1.41 2003/08/08 10:02:09 menno Small fix Revision 1.40 2003/08/07 08:17:00 knik Better LFE support (reduced bandwidth) Revision 1.39 2003/08/02 11:32:10 stux added config.inputFormat, and associated defines and code, faac now handles native endian 16bit, 24bit and float input. Added faacEncGetDecoderSpecificInfo to the dll exports, needed for MP4. Updated DLL .dsp to compile without error. Updated CFG_VERSION to 102. Version number might need to be updated as the API has technically changed. Did not update libfaac.pdf Revision 1.38 2003/07/10 19:17:01 knik 24-bit input Revision 1.37 2003/06/26 19:20:09 knik Mid/Side support. Copyright info moved from frontend. Fixed memory leak. Revision 1.36 2003/05/12 17:53:16 knik updated ABR table Revision 1.35 2003/05/10 09:39:55 knik added approximate ABR setting modified default cutoff Revision 1.34 2003/05/01 09:31:39 knik removed ISO psyodel disabled m/s coding fixed default bandwidth reduced max_sfb check Revision 1.33 2003/04/13 08:37:23 knik version number moved to version.h Revision 1.32 2003/03/27 17:08:23 knik added quantizer quality and bandwidth setting Revision 1.31 2002/10/11 18:00:15 menno small bugfix Revision 1.30 2002/10/08 18:53:01 menno Fixed some memory leakage Revision 1.29 2002/08/19 16:34:43 knik added one additional flush frame fixed sample buffer memory allocation */ faac-1.28/libfaac/frame.h0000644010307701030770000001014311137132170016663 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: frame.h,v 1.30 2009/01/25 18:50:32 menno Exp $ */ #ifndef FRAME_H #define FRAME_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifndef HAVE_INT32_T typedef signed int int32_t; #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "coder.h" #include "channels.h" #include "psych.h" #include "aacquant.h" #include "fft.h" #if defined(_WIN32) && !defined(__MINGW32__) #ifndef FAACAPI #define FAACAPI __stdcall #endif #else #ifndef FAACAPI #define FAACAPI #endif #endif #pragma pack(push, 1) typedef struct { psymodel_t *model; char *name; } psymodellist_t; #include typedef struct { /* number of channels in AAC file */ unsigned int numChannels; /* samplerate of AAC file */ unsigned long sampleRate; unsigned int sampleRateIdx; unsigned int usedBytes; /* frame number */ unsigned int frameNum; unsigned int flushFrame; /* Scalefactorband data */ SR_INFO *srInfo; /* sample buffers of current next and next next frame*/ double *sampleBuff[MAX_CHANNELS]; double *nextSampleBuff[MAX_CHANNELS]; double *next2SampleBuff[MAX_CHANNELS]; double *next3SampleBuff[MAX_CHANNELS]; double *ltpTimeBuff[MAX_CHANNELS]; /* Filterbank buffers */ double *sin_window_long; double *sin_window_short; double *kbd_window_long; double *kbd_window_short; double *freqBuff[MAX_CHANNELS]; double *overlapBuff[MAX_CHANNELS]; double *msSpectrum[MAX_CHANNELS]; /* Channel and Coder data for all channels */ CoderInfo coderInfo[MAX_CHANNELS]; ChannelInfo channelInfo[MAX_CHANNELS]; /* Psychoacoustics data */ PsyInfo psyInfo[MAX_CHANNELS]; GlobalPsyInfo gpsyInfo; /* Configuration data */ faacEncConfiguration config; psymodel_t *psymodel; /* quantizer specific config */ AACQuantCfg aacquantCfg; /* FFT Tables */ FFT_Tables fft_tables; /* output bits difference in average bitrate mode */ int bitDiff; } faacEncStruct, *faacEncHandle; int FAACAPI faacEncGetVersion(char **faac_id_string, char **faac_copyright_string); int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder, unsigned char** ppBuffer, unsigned long* pSizeOfDecoderSpecificInfo); faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder); int FAACAPI faacEncSetConfiguration (faacEncHandle hEncoder, faacEncConfigurationPtr config); faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate, unsigned int numChannels, unsigned long *inputSamples, unsigned long *maxOutputBytes); int FAACAPI faacEncEncode(faacEncHandle hEncoder, int32_t *inputBuffer, unsigned int samplesInput, unsigned char *outputBuffer, unsigned int bufferSize ); int FAACAPI faacEncClose(faacEncHandle hEncoder); #pragma pack(pop) #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* FRAME_H */ faac-1.28/libfaac/huffman.c0000644010307701030770000012765710200103360017220 0ustar fabian-guestfabian-guest/*********** This software module was originally developed by Dolby Laboratories and edited by Sony Corporation in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC13818-7, 14496-1, 2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for the developer's own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright 1996. ***********/ /* * $Id: huffman.c,v 1.11 2005/02/02 07:53:20 sur Exp $ */ #include #include #include "huffman.h" #include "coder.h" #include "bitstream.h" #include "util.h" #include "hufftab.h" void HuffmanInit(CoderInfo *coderInfo, unsigned int numChannels) { unsigned int channel; for (channel = 0; channel < numChannels; channel++) { coderInfo[channel].data = (int*)AllocMemory(5*FRAME_LEN*sizeof(int)); coderInfo[channel].len = (int*)AllocMemory(5*FRAME_LEN*sizeof(int)); #ifdef DRM coderInfo[channel].num_data_cw = (int*)AllocMemory(FRAME_LEN*sizeof(int)); #endif } } void HuffmanEnd(CoderInfo *coderInfo, unsigned int numChannels) { unsigned int channel; for (channel = 0; channel < numChannels; channel++) { if (coderInfo[channel].data) FreeMemory(coderInfo[channel].data); if (coderInfo[channel].len) FreeMemory(coderInfo[channel].len); #ifdef DRM if (coderInfo[channel].num_data_cw) FreeMemory(coderInfo[channel].num_data_cw); #endif } } int BitSearch(CoderInfo *coderInfo, int *quant) /* Quantized spectral values */ /* This function inputs a vector of quantized spectral data, quant[][], and returns a vector, 'book_vector[]' that describes how to group together the scalefactor bands into a smaller number of sections. There are MAX_SCFAC_BANDS elements in book_vector (equal to 49 in the case of long blocks and 112 for short blocks), and each element has a huffman codebook number assigned to it. For a quick and simple algorithm, this function performs a binary search across the sfb's (scale factor bands). On the first approach, it calculates the needed amount of bits if every sfb were its own section and transmitted its own huffman codebook value side information (equal to 9 bits for a long block, 7 for a short). The next iteration combines adjacent sfb's, and calculates the bit rate for length two sfb sections. If any wider two-sfb section requires fewer bits than the sum of the two single-sfb sections (below it in the binary tree), then the wider section will be chosen. This process occurs until the sections are split into three uniform parts, each with an equal amount of sfb's contained. The binary tree is stored as a two-dimensional array. Since this tree is not full, (there are only 49 nodes, not 2^6 = 64), the numbering is a little complicated. If the tree were full, the top node would be 1. It's children would be 2 and 3. But, since this tree is not full, the top row of three nodes are numbered {4,5,6}. The row below it is {8,9,10,11,12,13}, and so on. The binary tree is called bit_stats[112][3]. There are 112 total nodes (some are not used since it's not full). bit_stats[x][0] holds the bit totals needed for the sfb sectioning strategy represented by the node x in the tree. bit_stats[x][1] holds the optimal huffman codebook table that minimizes the bit rate, given the sectioning boundaries dictated by node x. */ { int i,j,k; int hop; int min_book_choice[112][3]; int bit_stats[240][3]; int total_bit_count; int levels; int pow2levels; int fracpow2lev; /* Set local pointer to coderInfo book_vector */ int* book_vector = coderInfo -> book_vector; levels = (int) ((log((double)coderInfo->nr_of_sfb)/log((double)2.0))+1); /* #define SLOW */ #ifdef SLOW for(i = 0; i < 5; i++) { #else i = 0; #endif hop = 1 << i; NoiselessBitCount(coderInfo, quant, hop, min_book_choice); /* load up the (not-full) binary search tree with the min_book_choice values */ k=0; total_bit_count = 0; pow2levels = 1 << (levels - i); fracpow2lev = pow2levels + (coderInfo->nr_of_sfb >> i); for (j=pow2levels; j < fracpow2lev; j++) { bit_stats[j][0] = min_book_choice[k][0]; /* the minimum bit cost for this section */ bit_stats[j][1] = min_book_choice[k][1]; /* used with this huffman book number */ #ifdef SLOW if (i>0){ /* not on the lowest level, grouping more than one signle scalefactor band per section*/ if (bit_stats[j][0] < bit_stats[2*j][0] + bit_stats[2*j+1][0]){ /* it is cheaper to combine surrounding sfb secionts into one larger huffman book section */ for(n=k;nsfb_offset; int nr_of_sfb = coderInfo->nr_of_sfb; /* each section is 'hop' scalefactor bands wide */ for (i=0; i < nr_of_sfb; i=i+hop){ #ifdef SLOW if ((i+hop) > nr_of_sfb) q = nr_of_sfb; else #endif q = i+hop; { /* find the maximum absolute value in the current spectral section, to see what tables are available to use */ max_sb_coeff = 0; for (j=sfb_offset[i]; j max_sb_coeff) max_sb_coeff = ABS(quant[j]); } j = 0; offset = sfb_offset[i]; #ifdef SLOW if ((i+hop) > nr_of_sfb){ end = sfb_offset[nr_of_sfb]; } else #endif end = sfb_offset[q]; length = end - offset; /* all spectral coefficients in this section are zero */ if (max_sb_coeff == 0) { book_choice[j][0] = CalcBits(coderInfo,0,quant,offset,length); book_choice[j++][1] = 0; } else { /* if the section does have non-zero coefficients */ if(max_sb_coeff < 2){ book_choice[j][0] = CalcBits(coderInfo,1,quant,offset,length); book_choice[j++][1] = 1; book_choice[j][0] = CalcBits(coderInfo,2,quant,offset,length); book_choice[j++][1] = 2; book_choice[j][0] = CalcBits(coderInfo,3,quant,offset,length); book_choice[j++][1] = 3; } else if (max_sb_coeff < 3){ book_choice[j][0] = CalcBits(coderInfo,3,quant,offset,length); book_choice[j++][1] = 3; book_choice[j][0] = CalcBits(coderInfo,4,quant,offset,length); book_choice[j++][1] = 4; book_choice[j][0] = CalcBits(coderInfo,5,quant,offset,length); book_choice[j++][1] = 5; } else if (max_sb_coeff < 5){ book_choice[j][0] = CalcBits(coderInfo,5,quant,offset,length); book_choice[j++][1] = 5; book_choice[j][0] = CalcBits(coderInfo,6,quant,offset,length); book_choice[j++][1] = 6; book_choice[j][0] = CalcBits(coderInfo,7,quant,offset,length); book_choice[j++][1] = 7; } else if (max_sb_coeff < 8){ book_choice[j][0] = CalcBits(coderInfo,7,quant,offset,length); book_choice[j++][1] = 7; book_choice[j][0] = CalcBits(coderInfo,8,quant,offset,length); book_choice[j++][1] = 8; book_choice[j][0] = CalcBits(coderInfo,9,quant,offset,length); book_choice[j++][1] = 9; } else if (max_sb_coeff < 13){ book_choice[j][0] = CalcBits(coderInfo,9,quant,offset,length); book_choice[j++][1] = 9; book_choice[j][0] = CalcBits(coderInfo,10,quant,offset,length); book_choice[j++][1] = 10; } /* (max_sb_coeff >= 13), choose table 11 */ else { book_choice[j][0] = CalcBits(coderInfo,11,quant,offset,length); book_choice[j++][1] = 11; } } /* find the minimum bit cost and table number for huffman coding this scalefactor section */ min_book_choice[i][1] = book_choice[0][1]; min_book_choice[i][0] = book_choice[0][0]; for(k=1;k= 1) { N++; x = x/2; } *len_esc_sequence = 2*N + 5; /* the length of the escape sequence in bits */ output = (int)((pow(2,N) - 1)*pow(2,N+5) + y - pow(2,N+4)); return(output); } int OutputBits(CoderInfo *coderInfo, #ifdef DRM int *book, /* we need to change book for VCB11 */ #else int book, #endif int *quant, int offset, int length) { /* This function inputs - a specific codebook number, 'book' - the quantized spectral data, 'quant[][]' - the offset into the spectral data to begin scanning, 'offset' - the 'length' of the segment to huffman code -> therefore, the segment quant[offset] to quant[offset+length-1] is huffman coded. This function outputs - the number of bits required, 'bits' using the prescribed codebook, book applied to the given segment of spectral data. There are three parameters that are passed back and forth into this function. data[] and len[] are one-dimensional arrays that store the codebook values and their respective bit lengths. These are used when packing the data for the bitstream in OutputBits(). The index into these arrays is 'coderInfo->spectral_count''. It gets incremented internally in this function as counter, then passed to the outside through outside_counter. The next time OutputBits() is called, counter starts at the value it left off from the previous call. */ int esc_sequence; int len_esc; int index; int bits=0; int tmp; int codebook,i,j; int counter; /* Set up local pointers to coderInfo elements data and len */ int* data= coderInfo->data; int* len= coderInfo->len; #ifdef DRM int* num_data = coderInfo->num_data_cw; int cur_cw_len; int max_esc_sequ = 0; #endif counter = coderInfo->spectral_count; #ifdef DRM switch (*book) { #else switch (book) { #endif case 0: case INTENSITY_HCB2: case INTENSITY_HCB: #ifdef DRM for(i=offset;idata[counter] = 0; coderInfo->len[counter++] = 0; coderInfo->spectral_count = counter; /* send the current count back to the outside world */ #ifdef DRM num_data[coderInfo->cur_cw++] = 1; } #endif return(bits); case 1: for(i=offset;icur_cw++] = 1; coderInfo->iLenReordSpData += tmp; if (tmp > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = tmp; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 2: for(i=offset;icur_cw++] = 1; coderInfo->iLenReordSpData += tmp; if (tmp > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = tmp; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 3: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<4;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 4: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<4;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 5: for(i=offset;icur_cw++] = 1; coderInfo->iLenReordSpData += tmp; if (tmp > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = tmp; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 6: for(i=offset;icur_cw++] = 1; coderInfo->iLenReordSpData += tmp; if (tmp > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = tmp; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 7: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<2;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 8: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<2;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 9: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<2;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 10: for(i=offset;icur_cw] = 1; cur_cw_len = tmp; #endif for(j=0;j<2;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ return(bits); case 11: /* First, calculate the indecies into the huffman tables */ for(i=offset;i= 16) && (ABS(quant[i+1]) >= 16)) { /* both codewords were above 16 */ /* first, code the orignal pair, with the larger value saturated to +/- 16 */ index = 17*16 + 16; } else if (ABS(quant[i]) >= 16) { /* the first codeword was above 16, not the second one */ /* first, code the orignal pair, with the larger value saturated to +/- 16 */ index = 17*16 + ABS(quant[i+1]); } else if (ABS(quant[i+1]) >= 16) { /* the second codeword was above 16, not the first one */ index = 17*ABS(quant[i]) + 16; } else { /* there were no values above 16, so no escape sequences */ index = 17*ABS(quant[i]) + ABS(quant[i+1]); } /* write out the codewords */ tmp = huff11[index][FIRSTINTAB]; codebook = huff11[index][LASTINTAB]; bits += tmp; data[counter] = codebook; len[counter++] = tmp; #ifdef DRM num_data[coderInfo->cur_cw] = 1; cur_cw_len = tmp; #endif /* Take care of the sign bits */ for(j=0;j<2;j++){ if(quant[i+j] > 0) { /* send out '0' if a positive value */ data[counter] = 0; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } else if(quant[i+j] < 0) { /* send out '1' if a negative value */ data[counter] = 1; len[counter++] = 1; bits += 1; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += 1; #endif } } /* write out the escape sequences */ if ((ABS(quant[i]) >= 16) && (ABS(quant[i+1]) >= 16)) { /* both codewords were above 16 */ /* code and transmit the first escape_sequence */ esc_sequence = CalculateEscSequence(quant[i],&len_esc); bits += len_esc; data[counter] = esc_sequence; len[counter++] = len_esc; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += len_esc; if (esc_sequence > max_esc_sequ) max_esc_sequ = esc_sequence; #endif /* then code and transmit the second escape_sequence */ esc_sequence = CalculateEscSequence(quant[i+1],&len_esc); bits += len_esc; data[counter] = esc_sequence; len[counter++] = len_esc; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += len_esc; if (esc_sequence > max_esc_sequ) max_esc_sequ = esc_sequence; #endif } else if (ABS(quant[i]) >= 16) { /* the first codeword was above 16, not the second one */ /* code and transmit the escape_sequence */ esc_sequence = CalculateEscSequence(quant[i],&len_esc); bits += len_esc; data[counter] = esc_sequence; len[counter++] = len_esc; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += len_esc; if (esc_sequence > max_esc_sequ) max_esc_sequ = esc_sequence; #endif } else if (ABS(quant[i+1]) >= 16) { /* the second codeword was above 16, not the first one */ /* code and transmit the escape_sequence */ esc_sequence = CalculateEscSequence(quant[i+1],&len_esc); bits += len_esc; data[counter] = esc_sequence; len[counter++] = len_esc; #ifdef DRM num_data[coderInfo->cur_cw]++; cur_cw_len += len_esc; if (esc_sequence > max_esc_sequ) max_esc_sequ = esc_sequence; #endif } #ifdef DRM coderInfo->iLenReordSpData += cur_cw_len; if (cur_cw_len > coderInfo->iLenLongestCW) coderInfo->iLenLongestCW = cur_cw_len; coderInfo->cur_cw++; #endif } coderInfo->spectral_count = counter; /* send the current count back to the outside world */ #ifdef DRM /* VCB11: check which codebook should be used using max escape sequence */ /* 8.5.3.1.3, table 157 */ if (max_esc_sequ <= 15) *book = 16; else if (max_esc_sequ <= 31) *book = 17; else if (max_esc_sequ <= 47) *book = 18; else if (max_esc_sequ <= 63) *book = 19; else if (max_esc_sequ <= 95) *book = 20; else if (max_esc_sequ <= 127) *book = 21; else if (max_esc_sequ <= 159) *book = 22; else if (max_esc_sequ <= 191) *book = 23; else if (max_esc_sequ <= 223) *book = 24; else if (max_esc_sequ <= 255) *book = 25; else if (max_esc_sequ <= 319) *book = 26; else if (max_esc_sequ <= 383) *book = 27; else if (max_esc_sequ <= 511) *book = 28; else if (max_esc_sequ <= 767) *book = 29; else if (max_esc_sequ <= 1023) *book = 30; else if (max_esc_sequ <= 2047) *book = 31; /* else: codebook 11 -> it is already 11 */ #endif return(bits); } return 0; } int CalcBits(CoderInfo *coderInfo, int book, int *quant, int offset, int length) { /* This function inputs - a specific codebook number, 'book' - the quantized spectral data, 'quant[]' - the offset into the spectral data to begin scanning, 'offset' - the 'length' of the segment to huffman code -> therefore, the segment quant[offset] to quant[offset+length-1] is huffman coded. This function outputs - the number of bits required, 'bits' using the prescribed codebook, book applied to the given segment of spectral data. */ int len_esc; int index; int bits = 0; int i, j; switch (book) { case 1: for(i=offset;i= 16) && (ABS(quant[i+1]) >= 16)) { /* both codewords were above 16 */ /* first, code the orignal pair, with the larger value saturated to +/- 16 */ index = 17*16 + 16; } else if (ABS(quant[i]) >= 16) { /* the first codeword was above 16, not the second one */ /* first, code the orignal pair, with the larger value saturated to +/- 16 */ index = 17*16 + ABS(quant[i+1]); } else if (ABS(quant[i+1]) >= 16) { /* the second codeword was above 16, not the first one */ index = 17*ABS(quant[i]) + 16; } else { /* there were no values above 16, so no escape sequences */ index = 17*ABS(quant[i]) + ABS(quant[i+1]); } /* write out the codewords */ bits += huff11[index][FIRSTINTAB]; /* Take care of the sign bits */ for(j=0;j<2;j++){ if(quant[i+j] != 0) bits += 1; /* only for non-zero spectral coefficients */ } /* write out the escape sequences */ if ((ABS(quant[i]) >= 16) && (ABS(quant[i+1]) >= 16)) { /* both codewords were above 16 */ /* code and transmit the first escape_sequence */ CalculateEscSequence(quant[i],&len_esc); bits += len_esc; /* then code and transmit the second escape_sequence */ CalculateEscSequence(quant[i+1],&len_esc); bits += len_esc; } else if (ABS(quant[i]) >= 16) { /* the first codeword was above 16, not the second one */ /* code and transmit the escape_sequence */ CalculateEscSequence(quant[i],&len_esc); bits += len_esc; } else if (ABS(quant[i+1]) >= 16) { /* the second codeword was above 16, not the first one */ /* code and transmit the escape_sequence */ CalculateEscSequence(quant[i+1],&len_esc); bits += len_esc; } } return (bits); } return 0; } int SortBookNumbers(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { /* This function inputs the vector, 'book_vector[]', which is of length MAX_SCFAC_BANDS, and contains the optimal huffman tables of each sfb. It returns the vector, 'output_book_vector[]', which has it's elements formatted for the encoded bit stream. It's syntax is: {sect_cb[0], length_segment[0], ... ,sect_cb[num_of_sections], length_segment[num_of_sections]} The above syntax is true, unless there is an escape sequence. An escape sequence occurs when a section is longer than 2 ^ (bit_len) long in units of scalefactor bands. Also, the integer returned from this function is the number of bits written in the bitstream, 'bit_count'. This function supports both long and short blocks. */ int i; int repeat_counter; int bit_count = 0; int previous; int max, bit_len/*,sfbs*/; int max_sfb,g,band; int sect_cb_bits = 4; /* Set local pointers to coderInfo elements */ int* book_vector = coderInfo->book_vector; #ifdef DRM sect_cb_bits = 5; /* 5 bits in case of VCB11 */ #endif if (coderInfo->block_type == ONLY_SHORT_WINDOW){ max = 7; bit_len = 3; } else { /* the block_type is a long,start, or stop window */ max = 31; bit_len = 5; } /* Compute number of scalefactor bands */ max_sfb = coderInfo->nr_of_sfb / coderInfo->num_window_groups; for (g = 0; g < coderInfo->num_window_groups; g++) { band=g*max_sfb; repeat_counter=1; previous = book_vector[band]; if (writeFlag) { PutBit(bitStream,book_vector[band],sect_cb_bits); } bit_count += sect_cb_bits; for (i=band+1;i= 16) && (previous <= 32))) { if (writeFlag) PutBit(bitStream,book_vector[i],sect_cb_bits); bit_count += sect_cb_bits; previous = book_vector[i]; repeat_counter=1; } else #endif if( (book_vector[i] != previous)) { if (writeFlag) { PutBit(bitStream,repeat_counter,bit_len); } bit_count += bit_len; if (repeat_counter == max){ /* in case you need to terminate an escape sequence */ if (writeFlag) PutBit(bitStream,0,bit_len); bit_count += bit_len; } if (writeFlag) PutBit(bitStream,book_vector[i],sect_cb_bits); bit_count += sect_cb_bits; previous = book_vector[i]; repeat_counter=1; } /* if the length of the section is longer than the amount of bits available in */ /* the bitsream, "max", then start up an escape sequence */ else if ((book_vector[i] == previous) && (repeat_counter == max)) { if (writeFlag) { PutBit(bitStream,repeat_counter,bit_len); } bit_count += bit_len; repeat_counter = 1; } else { repeat_counter++; } } #ifdef DRM if (!((previous == 11) || ((previous >= 16) && (previous <= 32)))) #endif { if (writeFlag) PutBit(bitStream,repeat_counter,bit_len); bit_count += bit_len; if (repeat_counter == max) { /* special case if the last section length is an */ /* escape sequence */ if (writeFlag) PutBit(bitStream,0,bit_len); bit_count += bit_len; } } } /* Bottom of group iteration */ return bit_count; } int WriteScalefactors(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag) { /* this function takes care of counting the number of bits necessary */ /* to encode the scalefactors. In addition, if the writeFlag == 1, */ /* then the scalefactors are written out the bitStream output bit */ /* stream. it returns k, the number of bits written to the bitstream*/ int i,j,bit_count=0; int diff,length,codeword; int previous_scale_factor; int previous_is_factor; /* Intensity stereo */ int index = 0; int nr_of_sfb_per_group; /* set local pointer to coderInfo elements */ int* scale_factors = coderInfo->scale_factor; if (coderInfo->block_type == ONLY_SHORT_WINDOW) { /* short windows */ nr_of_sfb_per_group = coderInfo->nr_of_sfb/coderInfo->num_window_groups; } else { nr_of_sfb_per_group = coderInfo->nr_of_sfb; coderInfo->num_window_groups = 1; coderInfo->window_group_length[0] = 1; } previous_scale_factor = coderInfo->global_gain; previous_is_factor = 0; for(j=0; jnum_window_groups; j++){ for(i=0;ibook_vector[index]==INTENSITY_HCB) || (coderInfo->book_vector[index]==INTENSITY_HCB2) ) { /* only send scalefactors if using non-zero codebooks */ diff = scale_factors[index] - previous_is_factor; if ((diff < 60)&&(diff >= -60)) length = huff12[diff+60][FIRSTINTAB]; else length = 0; bit_count+=length; previous_is_factor = scale_factors[index]; if (writeFlag == 1 ) { codeword = huff12[diff+60][LASTINTAB]; PutBit(bitStream,codeword,length); } } else if (coderInfo->book_vector[index]) { /* only send scalefactors if using non-zero codebooks */ diff = scale_factors[index] - previous_scale_factor; if ((diff < 60)&&(diff >= -60)) length = huff12[diff+60][FIRSTINTAB]; else length = 0; bit_count+=length; previous_scale_factor = scale_factors[index]; if (writeFlag == 1 ) { codeword = huff12[diff+60][LASTINTAB]; PutBit(bitStream,codeword,length); } } index++; } } return bit_count; } faac-1.28/libfaac/huffman.h0000644010307701030770000000544110074447763017242 0ustar fabian-guestfabian-guest/*********** This software module was originally developed by Dolby Laboratories in the course of development of the MPEG-2 AAC/MPEG-4 Audio standard ISO/IEC13818-7, 14496-1, 2 and 3. This software module is an implementation of a part of one or more MPEG-2 AAC/MPEG-4 Audio tools as specified by the MPEG-2 aac/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2aac/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 aac/MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 aac/MPEG-4 Audio conforming products. The original developer retains full right to use the code for the developer's own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 aac/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright 1996. ***********/ /* * $Id: huffman.h,v 1.6 2004/07/12 08:46:43 corrados Exp $ */ #ifndef HUFFMAN_H #define HUFFMAN_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "bitstream.h" #include "coder.h" /* Huffman tables */ #define MAXINDEX 289 #define NUMINTAB 2 #define FIRSTINTAB 0 #define LASTINTAB 1 #define INTENSITY_HCB 15 #define INTENSITY_HCB2 14 #define ABS(A) ((A) < 0 ? (-A) : (A)) #include "frame.h" void HuffmanInit(CoderInfo *coderInfo, unsigned int numChannels); void HuffmanEnd(CoderInfo *coderInfo, unsigned int numChannels); int BitSearch(CoderInfo *coderInfo, int *quant); int NoiselessBitCount(CoderInfo *coderInfo, int *quant, int hop, int min_book_choice[112][3]); static int CalculateEscSequence(int input, int *len_esc_sequence); int CalcBits(CoderInfo *coderInfo, int book, int *quant, int offset, int length); int OutputBits(CoderInfo *coderInfo, #ifdef DRM int *book, /* we need to change book for VCB11 */ #else int book, #endif int *quant, int offset, int length); int SortBookNumbers(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); int WriteScalefactors(CoderInfo *coderInfo, BitStream *bitStream, int writeFlag); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* HUFFMAN_H */ faac-1.28/libfaac/hufftab.h0000644010307701030770000004660107310211345017220 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: hufftab.h,v 1.3 2001/06/08 18:01:09 menno Exp $ */ unsigned short huff1[][2] = { { 11, 2040}, { 9, 497},{ 11, 2045},{ 10, 1013},{ 7, 104},{ 10, 1008}, { 11, 2039},{ 9, 492},{ 11, 2037},{ 10, 1009},{ 7, 114}, { 10, 1012},{ 7, 116},{ 5, 17},{ 7, 118},{ 9, 491}, { 7, 108},{ 10, 1014},{ 11, 2044},{ 9, 481},{ 11, 2033}, { 9, 496},{ 7, 97},{ 9, 502},{ 11, 2034},{ 9, 490}, { 11, 2043},{ 9, 498},{ 7, 105},{ 9, 493},{ 7, 119}, { 5, 23},{ 7, 111},{ 9, 486},{ 7, 100},{ 9, 485}, { 7, 103},{ 5, 21},{ 7, 98},{ 5, 18},{ 1, 0}, { 5, 20},{ 7, 101},{ 5, 22},{ 7, 109},{ 9, 489}, { 7, 99},{ 9, 484},{ 7, 107},{ 5, 19},{ 7, 113}, { 9, 483},{ 7, 112},{ 9, 499},{ 11, 2046},{ 9, 487}, { 11, 2035},{ 9, 495},{ 7, 96},{ 9, 494},{ 11, 2032}, { 9, 482},{ 11, 2042},{ 10, 1011},{ 7, 106},{ 9, 488}, { 7, 117},{ 5, 16},{ 7, 115},{ 9, 500},{ 7, 110}, { 10, 1015},{ 11, 2038},{ 9, 480},{ 11, 2041},{ 10, 1010}, { 7, 102},{ 9, 501},{ 11, 2047},{ 9, 503},{ 11, 2036} }; unsigned short huff2[][2] = { { 9, 499}, { 7, 111},{ 9, 509},{ 8, 235},{ 6, 35},{ 8, 234}, { 9, 503},{ 8, 232},{ 9, 506},{ 8, 242},{ 6, 45}, { 7, 112},{ 6, 32},{ 5, 6},{ 6, 43},{ 7, 110}, { 6, 40},{ 8, 233},{ 9, 505},{ 7, 102},{ 8, 248}, { 8, 231},{ 6, 27},{ 8, 241},{ 9, 500},{ 7, 107}, { 9, 501},{ 8, 236},{ 6, 42},{ 7, 108},{ 6, 44}, { 5, 10},{ 6, 39},{ 7, 103},{ 6, 26},{ 8, 245}, { 6, 36},{ 5, 8},{ 6, 31},{ 5, 9},{ 3, 0}, { 5, 7},{ 6, 29},{ 5, 11},{ 6, 48},{ 8, 239}, { 6, 28},{ 7, 100},{ 6, 30},{ 5, 12},{ 6, 41}, { 8, 243},{ 6, 47},{ 8, 240},{ 9, 508},{ 7, 113}, { 9, 498},{ 8, 244},{ 6, 33},{ 8, 230},{ 8, 247}, { 7, 104},{ 9, 504},{ 8, 238},{ 6, 34},{ 7, 101}, { 6, 49},{ 4, 2},{ 6, 38},{ 8, 237},{ 6, 37}, { 7, 106},{ 9, 507},{ 7, 114},{ 9, 510},{ 7, 105}, { 6, 46},{ 8, 246},{ 9, 511},{ 7, 109},{ 9, 502} }; unsigned short huff3[][2] = { { 1, 0}, { 4, 9},{ 8, 239},{ 4, 11},{ 5, 25},{ 8, 240}, { 9, 491},{ 9, 486},{ 10, 1010},{ 4, 10},{ 6, 53}, { 9, 495},{ 6, 52},{ 6, 55},{ 9, 489},{ 9, 493}, { 9, 487},{ 10, 1011},{ 9, 494},{ 10, 1005},{ 13, 8186}, { 9, 492},{ 9, 498},{ 11, 2041},{ 11, 2040},{ 10, 1016}, { 12, 4088},{ 4, 8},{ 6, 56},{ 10, 1014},{ 6, 54}, { 7, 117},{ 10, 1009},{ 10, 1003},{ 10, 1004},{ 12, 4084}, { 5, 24},{ 7, 118},{ 11, 2036},{ 6, 57},{ 7, 116}, { 10, 1007},{ 9, 499},{ 9, 500},{ 11, 2038},{ 9, 488}, { 10, 1002},{ 13, 8188},{ 8, 242},{ 9, 497},{ 12, 4091}, { 10, 1013},{ 11, 2035},{ 12, 4092},{ 8, 238},{ 10, 1015}, { 15, 32766},{ 9, 496},{ 11, 2037},{ 15, 32765},{ 13, 8187}, { 14, 16378},{ 16, 65535},{ 8, 241},{ 10, 1008},{ 14, 16380}, { 9, 490},{ 10, 1006},{ 14, 16379},{ 12, 4086},{ 12, 4090}, { 15, 32764},{ 11, 2034},{ 12, 4085},{ 16, 65534},{ 10, 1012}, { 11, 2039},{ 15, 32763},{ 12, 4087},{ 12, 4089},{ 15, 32762} }; unsigned short huff4[][2] = { { 4, 7}, { 5, 22},{ 8, 246},{ 5, 24},{ 4, 8},{ 8, 239}, { 9, 495},{ 8, 243},{ 11, 2040},{ 5, 25},{ 5, 23}, { 8, 237},{ 5, 21},{ 4, 1},{ 8, 226},{ 8, 240}, { 7, 112},{ 10, 1008},{ 9, 494},{ 8, 241},{ 11, 2042}, { 8, 238},{ 8, 228},{ 10, 1010},{ 11, 2038},{ 10, 1007}, { 11, 2045},{ 4, 5},{ 5, 20},{ 8, 242},{ 4, 9}, { 4, 4},{ 8, 229},{ 8, 244},{ 8, 232},{ 10, 1012}, { 4, 6},{ 4, 2},{ 8, 231},{ 4, 3},{ 4, 0}, { 7, 107},{ 8, 227},{ 7, 105},{ 9, 499},{ 8, 235}, { 8, 230},{ 10, 1014},{ 7, 110},{ 7, 106},{ 9, 500}, { 10, 1004},{ 9, 496},{ 10, 1017},{ 8, 245},{ 8, 236}, { 11, 2043},{ 8, 234},{ 7, 111},{ 10, 1015},{ 11, 2041}, { 10, 1011},{ 12, 4095},{ 8, 233},{ 7, 109},{ 10, 1016}, { 7, 108},{ 7, 104},{ 9, 501},{ 10, 1006},{ 9, 498}, { 11, 2036},{ 11, 2039},{ 10, 1009},{ 12, 4094},{ 10, 1005}, { 9, 497},{ 11, 2037},{ 11, 2046},{ 10, 1013},{ 11, 2044} }; unsigned short huff5[][2] = { { 13, 8191}, { 12, 4087},{ 11, 2036},{ 11, 2024},{ 10, 1009},{ 11, 2030}, { 11, 2041},{ 12, 4088},{ 13, 8189},{ 12, 4093},{ 11, 2033}, { 10, 1000},{ 9, 488},{ 8, 240},{ 9, 492},{ 10, 1006}, { 11, 2034},{ 12, 4090},{ 12, 4084},{ 10, 1007},{ 9, 498}, { 8, 232},{ 7, 112},{ 8, 236},{ 9, 496},{ 10, 1002}, { 11, 2035},{ 11, 2027},{ 9, 491},{ 8, 234},{ 5, 26}, { 4, 8},{ 5, 25},{ 8, 238},{ 9, 495},{ 11, 2029}, { 10, 1008},{ 8, 242},{ 7, 115},{ 4, 11},{ 1, 0}, { 4, 10},{ 7, 113},{ 8, 243},{ 11, 2025},{ 11, 2031}, { 9, 494},{ 8, 239},{ 5, 24},{ 4, 9},{ 5, 27}, { 8, 235},{ 9, 489},{ 11, 2028},{ 11, 2038},{ 10, 1003}, { 9, 499},{ 8, 237},{ 7, 114},{ 8, 233},{ 9, 497}, { 10, 1005},{ 11, 2039},{ 12, 4086},{ 11, 2032},{ 10, 1001}, { 9, 493},{ 8, 241},{ 9, 490},{ 10, 1004},{ 11, 2040}, { 12, 4089},{ 13, 8188},{ 12, 4092},{ 12, 4085},{ 11, 2026}, { 10, 1011},{ 10, 1010},{ 11, 2037},{ 12, 4091},{ 13, 8190} }; unsigned short huff6[][2] = { { 11, 2046}, { 10, 1021},{ 9, 497},{ 9, 491},{ 9, 500},{ 9, 490}, { 9, 496},{ 10, 1020},{ 11, 2045},{ 10, 1014},{ 9, 485}, { 8, 234},{ 7, 108},{ 7, 113},{ 7, 104},{ 8, 240}, { 9, 486},{ 10, 1015},{ 9, 499},{ 8, 239},{ 6, 50}, { 6, 39},{ 6, 40},{ 6, 38},{ 6, 49},{ 8, 235}, { 9, 503},{ 9, 488},{ 7, 111},{ 6, 46},{ 4, 8}, { 4, 4},{ 4, 6},{ 6, 41},{ 7, 107},{ 9, 494}, { 9, 495},{ 7, 114},{ 6, 45},{ 4, 2},{ 4, 0}, { 4, 3},{ 6, 47},{ 7, 115},{ 9, 506},{ 9, 487}, { 7, 110},{ 6, 43},{ 4, 7},{ 4, 1},{ 4, 5}, { 6, 44},{ 7, 109},{ 9, 492},{ 9, 505},{ 8, 238}, { 6, 48},{ 6, 36},{ 6, 42},{ 6, 37},{ 6, 51}, { 8, 236},{ 9, 498},{ 10, 1016},{ 9, 484},{ 8, 237}, { 7, 106},{ 7, 112},{ 7, 105},{ 7, 116},{ 8, 241}, { 10, 1018},{ 11, 2047},{ 10, 1017},{ 9, 502},{ 9, 493}, { 9, 504},{ 9, 489},{ 9, 501},{ 10, 1019},{ 11, 2044} }; unsigned short huff7[][2] = { { 1, 0}, { 3, 5},{ 6, 55},{ 7, 116},{ 8, 242},{ 9, 491}, { 10, 1005},{ 11, 2039},{ 3, 4},{ 4, 12},{ 6, 53}, { 7, 113},{ 8, 236},{ 8, 238},{ 9, 494},{ 9, 501}, { 6, 54},{ 6, 52},{ 7, 114},{ 8, 234},{ 8, 241}, { 9, 489},{ 9, 499},{ 10, 1013},{ 7, 115},{ 7, 112}, { 8, 235},{ 8, 240},{ 9, 497},{ 9, 496},{ 10, 1004}, { 10, 1018},{ 8, 243},{ 8, 237},{ 9, 488},{ 9, 495}, { 10, 1007},{ 10, 1009},{ 10, 1017},{ 11, 2043},{ 9, 493}, { 8, 239},{ 9, 490},{ 9, 498},{ 10, 1011},{ 10, 1016}, { 11, 2041},{ 11, 2044},{ 10, 1006},{ 9, 492},{ 9, 500}, { 10, 1012},{ 10, 1015},{ 11, 2040},{ 12, 4093},{ 12, 4094}, { 11, 2038},{ 10, 1008},{ 10, 1010},{ 10, 1014},{ 11, 2042}, { 11, 2045},{ 12, 4092},{ 12, 4095} }; unsigned short huff8[][2] = { { 5, 14}, { 4, 5},{ 5, 16},{ 6, 48},{ 7, 111},{ 8, 241}, { 9, 506},{ 10, 1022},{ 4, 3},{ 3, 0},{ 4, 4}, { 5, 18},{ 6, 44},{ 7, 106},{ 7, 117},{ 8, 248}, { 5, 15},{ 4, 2},{ 4, 6},{ 5, 20},{ 6, 46}, { 7, 105},{ 7, 114},{ 8, 245},{ 6, 47},{ 5, 17}, { 5, 19},{ 6, 42},{ 6, 50},{ 7, 108},{ 8, 236}, { 8, 250},{ 7, 113},{ 6, 43},{ 6, 45},{ 6, 49}, { 7, 109},{ 7, 112},{ 8, 242},{ 9, 505},{ 8, 239}, { 7, 104},{ 6, 51},{ 7, 107},{ 7, 110},{ 8, 238}, { 8, 249},{ 10, 1020},{ 9, 504},{ 7, 116},{ 7, 115}, { 8, 237},{ 8, 240},{ 8, 246},{ 9, 502},{ 9, 509}, { 10, 1021},{ 8, 243},{ 8, 244},{ 8, 247},{ 9, 503}, { 9, 507},{ 9, 508},{ 10, 1023} }; unsigned short huff9[][2] = { { 1, 0}, { 3, 5},{ 6, 55},{ 8, 231},{ 9, 478},{ 10, 974}, { 10, 985},{ 11, 1992},{ 11, 1997},{ 12, 4040},{ 12, 4061}, { 13, 8164},{ 13, 8172},{ 3, 4},{ 4, 12},{ 6, 53}, { 7, 114},{ 8, 234},{ 8, 237},{ 9, 482},{ 10, 977}, { 10, 979},{ 10, 992},{ 11, 2008},{ 12, 4047},{ 12, 4053}, { 6, 54},{ 6, 52},{ 7, 113},{ 8, 232},{ 8, 236}, { 9, 481},{ 10, 975},{ 10, 989},{ 10, 987},{ 11, 2000}, { 12, 4039},{ 12, 4052},{ 12, 4068},{ 8, 230},{ 7, 112}, { 8, 233},{ 9, 477},{ 9, 483},{ 10, 978},{ 10, 988}, { 11, 1996},{ 11, 1994},{ 11, 2014},{ 12, 4056},{ 12, 4074}, { 13, 8155},{ 9, 479},{ 8, 235},{ 9, 476},{ 9, 486}, { 10, 981},{ 10, 990},{ 11, 1995},{ 11, 2013},{ 11, 2012}, { 12, 4045},{ 12, 4066},{ 12, 4071},{ 13, 8161},{ 10, 976}, { 9, 480},{ 9, 484},{ 10, 982},{ 11, 1989},{ 11, 2001}, { 11, 2011},{ 12, 4050},{ 11, 2016},{ 12, 4057},{ 12, 4075}, { 13, 8163},{ 13, 8169},{ 11, 1988},{ 9, 485},{ 10, 983}, { 11, 1990},{ 11, 1999},{ 11, 2010},{ 12, 4043},{ 12, 4058}, { 12, 4067},{ 12, 4073},{ 13, 8166},{ 13, 8179},{ 13, 8183}, { 11, 2003},{ 10, 984},{ 10, 993},{ 11, 2004},{ 11, 2009}, { 12, 4051},{ 12, 4062},{ 13, 8157},{ 13, 8153},{ 13, 8162}, { 13, 8170},{ 13, 8177},{ 13, 8182},{ 11, 2002},{ 10, 980}, { 10, 986},{ 11, 1991},{ 11, 2007},{ 11, 2018},{ 12, 4046}, { 12, 4059},{ 13, 8152},{ 13, 8174},{ 14, 16368},{ 13, 8180}, { 14, 16370},{ 11, 2017},{ 10, 991},{ 11, 1993},{ 11, 2006}, { 12, 4042},{ 12, 4048},{ 12, 4069},{ 12, 4070},{ 13, 8171}, { 13, 8175},{ 14, 16371},{ 14, 16372},{ 14, 16373},{ 12, 4064}, { 11, 1998},{ 11, 2005},{ 12, 4038},{ 12, 4049},{ 12, 4065}, { 13, 8160},{ 13, 8168},{ 13, 8176},{ 14, 16369},{ 14, 16376}, { 14, 16374},{ 15, 32764},{ 12, 4072},{ 11, 2015},{ 12, 4041}, { 12, 4055},{ 12, 4060},{ 13, 8156},{ 13, 8159},{ 13, 8173}, { 13, 8181},{ 14, 16377},{ 14, 16379},{ 15, 32765},{ 15, 32766}, { 13, 8167},{ 12, 4044},{ 12, 4054},{ 12, 4063},{ 13, 8158}, { 13, 8154},{ 13, 8165},{ 13, 8178},{ 14, 16378},{ 14, 16375}, { 14, 16380},{ 14, 16381},{ 15, 32767} }; unsigned short huff10[][2] = { { 6, 34}, { 5, 8},{ 6, 29},{ 6, 38},{ 7, 95},{ 8, 211}, { 9, 463},{ 10, 976},{ 10, 983},{ 10, 1005},{ 11, 2032}, { 11, 2038},{ 12, 4093},{ 5, 7},{ 4, 0},{ 4, 1}, { 5, 9},{ 6, 32},{ 7, 84},{ 7, 96},{ 8, 213}, { 8, 220},{ 9, 468},{ 10, 973},{ 10, 990},{ 11, 2023}, { 6, 28},{ 4, 2},{ 5, 6},{ 5, 12},{ 6, 30}, { 6, 40},{ 7, 91},{ 8, 205},{ 8, 217},{ 9, 462}, { 9, 476},{ 10, 985},{ 10, 1009},{ 6, 37},{ 5, 11}, { 5, 10},{ 5, 13},{ 6, 36},{ 7, 87},{ 7, 97}, { 8, 204},{ 8, 221},{ 9, 460},{ 9, 478},{ 10, 979}, { 10, 999},{ 7, 93},{ 6, 33},{ 6, 31},{ 6, 35}, { 6, 39},{ 7, 89},{ 7, 100},{ 8, 216},{ 8, 223}, { 9, 466},{ 9, 482},{ 10, 989},{ 10, 1006},{ 8, 209}, { 7, 85},{ 6, 41},{ 7, 86},{ 7, 88},{ 7, 98}, { 8, 206},{ 8, 224},{ 8, 226},{ 9, 474},{ 10, 980}, { 10, 995},{ 11, 2027},{ 9, 457},{ 7, 94},{ 7, 90}, { 7, 92},{ 7, 99},{ 8, 202},{ 8, 218},{ 9, 455}, { 9, 458},{ 9, 480},{ 10, 987},{ 10, 1000},{ 11, 2028}, { 9, 483},{ 8, 210},{ 8, 203},{ 8, 208},{ 8, 215}, { 8, 219},{ 9, 454},{ 9, 469},{ 9, 472},{ 10, 970}, { 10, 986},{ 11, 2026},{ 11, 2033},{ 9, 481},{ 8, 212}, { 8, 207},{ 8, 214},{ 8, 222},{ 8, 225},{ 9, 464}, { 9, 470},{ 10, 977},{ 10, 981},{ 10, 1010},{ 11, 2030}, { 11, 2043},{ 10, 1001},{ 9, 461},{ 9, 456},{ 9, 459}, { 9, 465},{ 9, 471},{ 9, 479},{ 10, 975},{ 10, 992}, { 10, 1007},{ 11, 2022},{ 11, 2040},{ 12, 4090},{ 10, 1003}, { 9, 477},{ 9, 467},{ 9, 473},{ 9, 475},{ 10, 978}, { 10, 972},{ 10, 988},{ 10, 1002},{ 11, 2029},{ 11, 2035}, { 11, 2041},{ 12, 4089},{ 11, 2034},{ 10, 974},{ 9, 484}, { 10, 971},{ 10, 984},{ 10, 982},{ 10, 994},{ 10, 997}, { 11, 2024},{ 11, 2036},{ 11, 2037},{ 11, 2039},{ 12, 4091}, { 11, 2042},{ 10, 1004},{ 10, 991},{ 10, 993},{ 10, 996}, { 10, 998},{ 10, 1008},{ 11, 2025},{ 11, 2031},{ 12, 4088}, { 12, 4094},{ 12, 4092},{ 12, 4095} }; unsigned short huff11[][2] = { { 4, 0}, { 5, 6},{ 6, 25},{ 7, 61},{ 8, 156},{ 8, 198}, { 9, 423},{ 10, 912},{ 10, 962},{ 10, 991},{ 11, 2022}, { 11, 2035},{ 12, 4091},{ 11, 2028},{ 12, 4090},{ 12, 4094}, { 10, 910},{ 5, 5},{ 4, 1},{ 5, 8},{ 6, 20}, { 7, 55},{ 7, 66},{ 8, 146},{ 8, 175},{ 9, 401}, { 9, 421},{ 9, 437},{ 10, 926},{ 10, 960},{ 10, 930}, { 10, 973},{ 11, 2006},{ 8, 174},{ 6, 23},{ 5, 7}, { 5, 9},{ 6, 24},{ 7, 57},{ 7, 64},{ 8, 142}, { 8, 163},{ 8, 184},{ 9, 409},{ 9, 428},{ 9, 449}, { 10, 945},{ 10, 918},{ 10, 958},{ 10, 970},{ 8, 157}, { 7, 60},{ 6, 21},{ 6, 22},{ 6, 26},{ 7, 59}, { 7, 68},{ 8, 145},{ 8, 165},{ 8, 190},{ 9, 406}, { 9, 430},{ 9, 441},{ 10, 929},{ 10, 913},{ 10, 933}, { 10, 981},{ 8, 148},{ 8, 154},{ 7, 54},{ 7, 56}, { 7, 58},{ 7, 65},{ 8, 140},{ 8, 155},{ 8, 176}, { 8, 195},{ 9, 414},{ 9, 427},{ 9, 444},{ 10, 927}, { 10, 911},{ 10, 937},{ 10, 975},{ 8, 147},{ 8, 191}, { 7, 62},{ 7, 63},{ 7, 67},{ 7, 69},{ 8, 158}, { 8, 167},{ 8, 185},{ 9, 404},{ 9, 418},{ 9, 442}, { 9, 451},{ 10, 934},{ 10, 935},{ 10, 955},{ 10, 980}, { 8, 159},{ 9, 416},{ 8, 143},{ 8, 141},{ 8, 144}, { 8, 152},{ 8, 166},{ 8, 182},{ 8, 196},{ 9, 415}, { 9, 431},{ 9, 447},{ 10, 921},{ 10, 959},{ 10, 948}, { 10, 969},{ 10, 999},{ 8, 168},{ 9, 438},{ 8, 171}, { 8, 164},{ 8, 170},{ 8, 178},{ 8, 194},{ 8, 197}, { 9, 408},{ 9, 420},{ 9, 440},{ 10, 908},{ 10, 932}, { 10, 964},{ 10, 966},{ 10, 989},{ 10, 1000},{ 8, 173}, { 10, 943},{ 9, 402},{ 8, 189},{ 8, 188},{ 9, 398}, { 9, 407},{ 9, 410},{ 9, 419},{ 9, 433},{ 10, 909}, { 10, 920},{ 10, 951},{ 10, 979},{ 10, 977},{ 10, 987}, { 11, 2013},{ 8, 180},{ 10, 990},{ 9, 425},{ 9, 411}, { 9, 412},{ 9, 417},{ 9, 426},{ 9, 429},{ 9, 435}, { 10, 907},{ 10, 946},{ 10, 952},{ 10, 974},{ 10, 993}, { 10, 992},{ 11, 2002},{ 11, 2021},{ 8, 183},{ 11, 2019}, { 9, 443},{ 9, 424},{ 9, 422},{ 9, 432},{ 9, 434}, { 9, 439},{ 10, 923},{ 10, 922},{ 10, 954},{ 10, 949}, { 10, 982},{ 11, 2007},{ 10, 996},{ 11, 2008},{ 11, 2026}, { 8, 186},{ 11, 2024},{ 10, 928},{ 9, 445},{ 9, 436}, { 10, 906},{ 9, 452},{ 10, 914},{ 10, 938},{ 10, 944}, { 10, 956},{ 10, 983},{ 11, 2004},{ 11, 2012},{ 11, 2011}, { 11, 2005},{ 11, 2032},{ 8, 193},{ 11, 2043},{ 10, 968}, { 10, 931},{ 10, 917},{ 10, 925},{ 10, 940},{ 10, 942}, { 10, 965},{ 10, 984},{ 10, 994},{ 10, 998},{ 11, 2020}, { 11, 2023},{ 11, 2016},{ 11, 2025},{ 11, 2039},{ 9, 400}, { 11, 2034},{ 10, 915},{ 9, 446},{ 9, 448},{ 10, 916}, { 10, 919},{ 10, 941},{ 10, 963},{ 10, 961},{ 10, 978}, { 11, 2010},{ 11, 2009},{ 11, 2015},{ 11, 2027},{ 11, 2036}, { 11, 2042},{ 9, 405},{ 11, 2040},{ 10, 957},{ 10, 924}, { 10, 939},{ 10, 936},{ 10, 947},{ 10, 953},{ 10, 976}, { 10, 995},{ 10, 997},{ 11, 2018},{ 11, 2014},{ 11, 2029}, { 11, 2033},{ 11, 2041},{ 11, 2044},{ 9, 403},{ 12, 4093}, { 10, 988},{ 10, 950},{ 10, 967},{ 10, 972},{ 10, 971}, { 10, 985},{ 10, 986},{ 11, 2003},{ 11, 2017},{ 11, 2030}, { 11, 2031},{ 11, 2037},{ 11, 2038},{ 12, 4092},{ 12, 4095}, { 9, 413},{ 9, 450},{ 8, 181},{ 8, 161},{ 8, 150}, { 8, 151},{ 8, 149},{ 8, 153},{ 8, 160},{ 8, 162}, { 8, 172},{ 8, 169},{ 8, 177},{ 8, 179},{ 8, 187}, { 8, 192},{ 9, 399},{ 5, 4} }; unsigned int huff12[][2] = { { 18, 262120}, { 18, 262118},{ 18, 262119},{ 18, 262117},{ 19, 524277},{ 19, 524273}, { 19, 524269},{ 19, 524278},{ 19, 524270},{ 19, 524271},{ 19, 524272}, { 19, 524284},{ 19, 524285},{ 19, 524287},{ 19, 524286},{ 19, 524279}, { 19, 524280},{ 19, 524283},{ 19, 524281},{ 18, 262116},{ 19, 524282}, { 18, 262115},{ 17, 131055},{ 17, 131056},{ 16, 65525},{ 17, 131054}, { 16, 65522},{ 16, 65523},{ 16, 65524},{ 16, 65521},{ 15, 32758}, { 15, 32759},{ 14, 16377},{ 14, 16373},{ 14, 16375},{ 14, 16371}, { 14, 16374},{ 14, 16370},{ 13, 8183},{ 13, 8181},{ 12, 4089}, { 12, 4087},{ 12, 4086},{ 11, 2041},{ 12, 4084},{ 11, 2040}, { 10, 1017},{ 10, 1015},{ 10, 1013},{ 9, 504},{ 9, 503}, { 8, 250},{ 8, 248},{ 8, 246},{ 7, 121},{ 6, 58}, { 6, 56},{ 5, 26},{ 4, 11},{ 3, 4},{ 1, 0}, { 4, 10},{ 4, 12},{ 5, 27},{ 6, 57},{ 6, 59}, { 7, 120},{ 7, 122},{ 8, 247},{ 8, 249},{ 9, 502}, { 9, 505},{ 10, 1012},{ 10, 1014},{ 10, 1016},{ 11, 2037}, { 11, 2036},{ 11, 2038},{ 11, 2039},{ 12, 4085},{ 12, 4088}, { 13, 8180},{ 13, 8182},{ 13, 8184},{ 14, 16376},{ 14, 16372}, { 16, 65520},{ 15, 32756},{ 16, 65526},{ 15, 32757},{ 18, 262114}, { 19, 524249},{ 19, 524250},{ 19, 524251},{ 19, 524252},{ 19, 524253}, { 19, 524254},{ 19, 524248},{ 19, 524242},{ 19, 524243},{ 19, 524244}, { 19, 524245},{ 19, 524246},{ 19, 524274},{ 19, 524255},{ 19, 524263}, { 19, 524264},{ 19, 524265},{ 19, 524266},{ 19, 524267},{ 19, 524262}, { 19, 524256},{ 19, 524257},{ 19, 524258},{ 19, 524259},{ 19, 524260}, { 19, 524261},{ 19, 524247},{ 19, 524268},{ 19, 524276},{ 19, 524275} }; faac-1.28/libfaac/libfaac.def0000644010307701030770000000044207755360066017504 0ustar fabian-guestfabian-guestLIBRARY libfaac.dll EXPORTS ; ; libfaac exports ; faacEncOpen @1 faacEncGetCurrentConfiguration @2 faacEncSetConfiguration @3 faacEncEncode @4 faacEncClose @5 faacEncGetDecoderSpecificInfo @6 faacEncGetVersion @7 faac-1.28/libfaac/libfaac.vcproj0000644010307701030770000001222710663100426020235 0ustar fabian-guestfabian-guest faac-1.28/libfaac/libfaac_dll.sln0000644010307701030770000000154310776017247020375 0ustar fabian-guestfabian-guestMicrosoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac_dll", "libfaac_dll.vcproj", "{856BB8CF-B944-4D7A-9D59-4945316229AA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {856BB8CF-B944-4D7A-9D59-4945316229AA}.Debug|Win32.ActiveCfg = Debug|Win32 {856BB8CF-B944-4D7A-9D59-4945316229AA}.Debug|Win32.Build.0 = Debug|Win32 {856BB8CF-B944-4D7A-9D59-4945316229AA}.Release|Win32.ActiveCfg = Release|Win32 {856BB8CF-B944-4D7A-9D59-4945316229AA}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/libfaac/libfaac_dll.vcproj0000644010307701030770000001463210776017250021101 0ustar fabian-guestfabian-guest faac-1.28/libfaac/libfaac_dll_drm.sln0000644010307701030770000000241310776017250021226 0ustar fabian-guestfabian-guestMicrosoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac_dll", "libfaac_dll_drm.vcproj", "{AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug DRM|Win32 = Debug DRM|Win32 Debug|Win32 = Debug|Win32 Release DRM|Win32 = Release DRM|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug DRM|Win32.ActiveCfg = Debug DRM|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug DRM|Win32.Build.0 = Debug DRM|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug|Win32.ActiveCfg = Debug|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug|Win32.Build.0 = Debug|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release DRM|Win32.ActiveCfg = Release DRM|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release DRM|Win32.Build.0 = Release DRM|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release|Win32.ActiveCfg = Release|Win32 {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/libfaac/libfaac_dll_drm.vcproj0000644010307701030770000002502510776017250021741 0ustar fabian-guestfabian-guest faac-1.28/libfaac/libfaacdrm.def0000644010307701030770000000041510200103607020156 0ustar fabian-guestfabian-guestEXPORTS ; ; libfaac exports ; faacEncOpen @1 faacEncGetCurrentConfiguration @2 faacEncSetConfiguration @3 faacEncEncode @4 faacEncClose @5 faacEncGetDecoderSpecificInfo @6 faacEncGetVersion @7 faac-1.28/libfaac/ltp.c0000644010307701030770000003007207676643577016425 0ustar fabian-guestfabian-guest/************************************************************************** This software module was originally developed by Nokia in the course of development of the MPEG-2 AAC/MPEG-4 Audio standard ISO/IEC13818-7, 14496-1, 2 and 3. This software module is an implementation of a part of one or more MPEG-2 AAC/MPEG-4 Audio tools as specified by the MPEG-2 aac/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2aac/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 aac/MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 aac/MPEG-4 Audio conforming products. The original developer retains full right to use the code for the developer's own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 aac/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c)1997. ***************************************************************************/ /* * $Id: ltp.c,v 1.9 2003/06/26 19:20:31 knik Exp $ */ #include #include #include "frame.h" #include "coder.h" #include "ltp.h" #include "tns.h" #include "filtbank.h" #include "util.h" /* short double_to_int(double sig_in); */ #define double_to_int(sig_in) \ ((sig_in) > 32767 ? 32767 : ( \ (sig_in) < -32768 ? -32768 : (sig_in))) #define _MDCT_SCALE 512 /* Purpose: Codebook for LTP weight coefficients. */ static double codebook[CODESIZE] = { 0.570829, 0.696616, 0.813004, 0.911304, 0.984900, 1.067894, 1.194601, 1.369533 }; static double snr_pred(double *mdct_in, double *mdct_pred, int *sfb_flag, int *sfb_offset, int block_type, int side_info, int num_of_sfb) { int i, j, flen; double snr_limit; double num_bit, snr[NSFB_LONG]; double temp1, temp2; double energy[BLOCK_LEN_LONG], snr_p[BLOCK_LEN_LONG]; if (block_type != ONLY_SHORT_WINDOW) { flen = BLOCK_LEN_LONG; snr_limit = 1.e-30; } else { flen = BLOCK_LEN_SHORT; snr_limit = 1.e-20; } for (i = 0; i < flen; i++) { energy[i] = mdct_in[i] * mdct_in[i]; snr_p[i] = (mdct_in[i] - mdct_pred[i]) * (mdct_in[i] - mdct_pred[i]); } num_bit = 0.0; for (i = 0; i < num_of_sfb; i++) { temp1 = 0.0; temp2 = 0.0; for (j = sfb_offset[i]; j < sfb_offset[i + 1]; j++) { temp1 += energy[j]; temp2 += snr_p[j]; } if (temp2 < snr_limit) temp2 = snr_limit; if (temp1 > 1.e-20) snr[i] = -10. * log10 (temp2 / temp1); else snr[i] = 0.0; sfb_flag[i] = 1; if (block_type != ONLY_SHORT_WINDOW) { if (snr[i] <= 0.0) { sfb_flag[i] = 0; for (j = sfb_offset[i]; j < sfb_offset[i + 1]; j++) mdct_pred[j] = 0.0; } else { num_bit += snr[i] / 6. * (sfb_offset[i + 1] - sfb_offset[i]); } } } if (num_bit < side_info) { // printf("LTP not used!, num_bit: %f ", num_bit); num_bit = 0.0; for (j = 0; j < flen; j++) mdct_pred[j] = 0.0; for (i = 0; i < num_of_sfb; i++) sfb_flag[i] = 0; } else { num_bit -= side_info; // printf("LTP used!, num_bit: %f ", num_bit); } return (num_bit); } static void prediction(double *buffer, double *predicted_samples, double *weight, int lag, int flen) { int i, offset; int num_samples; offset = NOK_LT_BLEN - flen / 2 - lag; num_samples = flen; if(NOK_LT_BLEN - offset < flen) num_samples = NOK_LT_BLEN - offset; for(i = 0; i < num_samples; i++) predicted_samples[i] = *weight * _MDCT_SCALE*buffer[offset++]; for( ; i < flen; i++) predicted_samples[i] = 0.0; } static void w_quantize(double *freq, int *ltp_idx) { int i; double dist, low; low = 1.0e+10; dist = 0.0; for (i = 0; i < CODESIZE; i++) { dist = (*freq - codebook[i]) * (*freq - codebook[i]); if (dist < low) { low = dist; *ltp_idx = i; } } *freq = codebook[*ltp_idx]; } static int pitch(double *sb_samples, double *x_buffer, int flen, int lag0, int lag1, double *predicted_samples, double *gain, int *cb_idx) { int i, j, delay; double corr1, corr2, lag_corr; double p_max, energy, lag_energy; /* * Below is a figure illustrating how the lag and the * samples in the buffer relate to each other. * * ------------------------------------------------------------------ * | | | | | * | slot 1 | 2 | 3 | 4 | * | | | | | * ------------------------------------------------------------------ * * lag = 0 refers to the end of slot 4 and lag = DELAY refers to the end * of slot 2. The start of the predicted frame is then obtained by * adding the length of the frame to the lag. Remember that slot 4 doesn't * actually exist, since it is always filled with zeros. * * The above short explanation was for long blocks. For short blocks the * zero lag doesn't refer to the end of slot 4 but to the start of slot * 4 - the frame length of a short block. * * Some extra code is then needed to handle those lag values that refer * to slot 4. */ p_max = 0.0; lag_corr = lag_energy = 0.0; delay = lag0; for (i = lag0; iblock_type, sfb_offset, mdct_predicted); /* Get the prediction gain. */ bit_gain = snr_pred(p_spectrum, mdct_predicted, sfb_prediction_used, sfb_offset, side_info, last_band, coderInfo->nr_of_sfb); return (bit_gain); } void LtpInit(faacEncHandle hEncoder) { int i; unsigned int channel; for (channel = 0; channel < hEncoder->numChannels; channel++) { LtpInfo *ltpInfo = &(hEncoder->coderInfo[channel].ltpInfo); ltpInfo->buffer = AllocMemory(NOK_LT_BLEN * sizeof(double)); ltpInfo->mdct_predicted = AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); ltpInfo->time_buffer = AllocMemory(BLOCK_LEN_LONG*sizeof(double)); ltpInfo->ltp_overlap_buffer = AllocMemory(BLOCK_LEN_LONG*sizeof(double)); for (i = 0; i < NOK_LT_BLEN; i++) ltpInfo->buffer[i] = 0; ltpInfo->weight_idx = 0; for(i = 0; i < MAX_SHORT_WINDOWS; i++) ltpInfo->sbk_prediction_used[i] = ltpInfo->delay[i] = 0; for(i = 0; i < MAX_SCFAC_BANDS; i++) ltpInfo->sfb_prediction_used[i] = 0; ltpInfo->side_info = LEN_LTP_DATA_PRESENT; for(i = 0; i < 2 * BLOCK_LEN_LONG; i++) ltpInfo->mdct_predicted[i] = 0.0; } } void LtpEnd(faacEncHandle hEncoder) { unsigned int channel; for (channel = 0; channel < hEncoder->numChannels; channel++) { LtpInfo *ltpInfo = &(hEncoder->coderInfo[channel].ltpInfo); if (ltpInfo->buffer) FreeMemory(ltpInfo->buffer); if (ltpInfo->mdct_predicted) FreeMemory(ltpInfo->mdct_predicted); if (ltpInfo->time_buffer) FreeMemory(ltpInfo->time_buffer); if (ltpInfo->ltp_overlap_buffer) FreeMemory(ltpInfo->ltp_overlap_buffer); } } int LtpEncode(faacEncHandle hEncoder, CoderInfo *coderInfo, LtpInfo *ltpInfo, TnsInfo *tnsInfo, double *p_spectrum, double *p_time_signal) { int i, last_band; double num_bit[MAX_SHORT_WINDOWS]; double *predicted_samples; ltpInfo->global_pred_flag = 0; ltpInfo->side_info = 0; predicted_samples = (double*)AllocMemory(2*BLOCK_LEN_LONG*sizeof(double)); switch(coderInfo->block_type) { case ONLY_LONG_WINDOW: case LONG_SHORT_WINDOW: case SHORT_LONG_WINDOW: last_band = (coderInfo->nr_of_sfb < MAX_LT_PRED_LONG_SFB) ? coderInfo->nr_of_sfb : MAX_LT_PRED_LONG_SFB; ltpInfo->delay[0] = pitch(p_time_signal, ltpInfo->buffer, 2 * BLOCK_LEN_LONG, 0, 2 * BLOCK_LEN_LONG, predicted_samples, <pInfo->weight, <pInfo->weight_idx); num_bit[0] = ltp_enc_tf(hEncoder, coderInfo, p_spectrum, predicted_samples, ltpInfo->mdct_predicted, coderInfo->sfb_offset, coderInfo->nr_of_sfb, last_band, ltpInfo->side_info, ltpInfo->sfb_prediction_used, tnsInfo); ltpInfo->global_pred_flag = (num_bit[0] == 0.0) ? 0 : 1; if(ltpInfo->global_pred_flag) for (i = 0; i < coderInfo->sfb_offset[last_band]; i++) p_spectrum[i] -= ltpInfo->mdct_predicted[i]; else ltpInfo->side_info = 1; break; default: break; } if (predicted_samples) FreeMemory(predicted_samples); return (ltpInfo->global_pred_flag); } void LtpReconstruct(CoderInfo *coderInfo, LtpInfo *ltpInfo, double *p_spectrum) { int i, last_band; if(ltpInfo->global_pred_flag) { switch(coderInfo->block_type) { case ONLY_LONG_WINDOW: case LONG_SHORT_WINDOW: case SHORT_LONG_WINDOW: last_band = (coderInfo->nr_of_sfb < MAX_LT_PRED_LONG_SFB) ? coderInfo->nr_of_sfb : MAX_LT_PRED_LONG_SFB; for (i = 0; i < coderInfo->sfb_offset[last_band]; i++) p_spectrum[i] += ltpInfo->mdct_predicted[i]; break; default: break; } } } void LtpUpdate(LtpInfo *ltpInfo, double *time_signal, double *overlap_signal, int block_size_long) { int i; for(i = 0; i < NOK_LT_BLEN - 2 * block_size_long; i++) ltpInfo->buffer[i] = ltpInfo->buffer[i + block_size_long]; for(i = 0; i < block_size_long; i++) { ltpInfo->buffer[NOK_LT_BLEN - 2 * block_size_long + i] = time_signal[i]; ltpInfo->buffer[NOK_LT_BLEN - block_size_long + i] = overlap_signal[i]; } } faac-1.28/libfaac/ltp.h0000644010307701030770000000266107310211345016376 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: ltp.h,v 1.3 2001/06/08 18:01:09 menno Exp $ */ #ifndef LTP_H #define LTP_H #include "coder.h" void LtpInit(faacEncHandle hEncoder); void LtpEnd(faacEncHandle hEncoder); int LtpEncode(faacEncHandle hEncoder, CoderInfo *coderInfo, LtpInfo *ltpInfo, TnsInfo *tnsInfo, double *p_spectrum, double *p_time_signal); void LtpReconstruct(CoderInfo *coderInfo, LtpInfo *ltpInfo, double *p_spectrum); void LtpUpdate(LtpInfo *ltpInfo, double *time_signal, double *overlap_signal, int block_size_long); #endif /* not defined LTP_H */ faac-1.28/libfaac/midside.c0000644010307701030770000001026407676646012017230 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2003 Krzysztof Nikiel * * 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 * * $Id: midside.c,v 1.1 2003/06/26 19:39:54 knik Exp $ */ #include #include "channels.h" #include "util.h" void MSEncode(CoderInfo *coderInfo, ChannelInfo *channelInfo, double *spectrum[MAX_CHANNELS], int maxchan, int allowms) { int chn; for (chn = 0; chn < maxchan; chn++) { if (channelInfo[chn].present) { if ((channelInfo[chn].cpe) && (channelInfo[chn].ch_is_left)) { int rch = channelInfo[chn].paired_ch; channelInfo[chn].msInfo.is_present = 0; channelInfo[rch].msInfo.is_present = 0; /* Perform MS if block_types are the same */ if ((coderInfo[chn].block_type == coderInfo[rch].block_type) && allowms) { int nsfb = coderInfo[chn].nr_of_sfb; MSInfo *msInfoL = &(channelInfo[chn].msInfo); MSInfo *msInfoR = &(channelInfo[rch].msInfo); int sfb; channelInfo[chn].common_window = 1; /* Use common window */ channelInfo[chn].msInfo.is_present = 1; channelInfo[rch].msInfo.is_present = 1; // make the same reference energy in both channels coderInfo[chn].avgenrg = coderInfo[rch].avgenrg = 0.5 * (coderInfo[chn].avgenrg + coderInfo[rch].avgenrg); for (sfb = 0; sfb < nsfb; sfb++) { int ms = 0; int l, start, end; double sum, diff; double enrgs, enrgd, enrgl, enrgr; double maxs, maxd, maxl, maxr; start = coderInfo[chn].sfb_offset[sfb]; end = coderInfo[chn].sfb_offset[sfb + 1]; enrgs = enrgd = enrgl = enrgr = 0.0; maxs = maxd = maxl = maxr = 0.0; for (l = start; l < end; l++) { double lx = spectrum[chn][l]; double rx = spectrum[rch][l]; sum = 0.5 * (lx + rx); diff = 0.5 * (lx - rx); enrgs += sum * sum; maxs = max(maxs, fabs(sum)); enrgd += diff * diff; maxd = max(maxd, fabs(diff)); enrgl += lx * lx; enrgr += rx * rx; maxl = max(maxl, fabs(lx)); maxr = max(maxr, fabs(rx)); } #if 1 if ((min(enrgs, enrgd) < min(enrgl, enrgr)) && (min(maxs, maxd) < min(maxl, maxr))) ms = 1; #else if (min(enrgs, enrgd) < min(enrgl, enrgr)) ms = 1; #endif //printf("%d:%d\n", sfb, ms); msInfoR->ms_used[sfb] = msInfoL->ms_used[sfb] = ms; if (ms) for (l = start; l < end; l++) { sum = spectrum[chn][l] + spectrum[rch][l]; diff = spectrum[chn][l] - spectrum[rch][l]; spectrum[chn][l] = 0.5 * sum; spectrum[rch][l] = 0.5 * diff; } } } } } } } void MSReconstruct(CoderInfo *coderInfo, ChannelInfo *channelInfo, int maxchan) { int chn; for (chn = 0; chn < maxchan; chn++) { if (channelInfo[chn].present) { if (channelInfo[chn].cpe && channelInfo[chn].ch_is_left) { int rch = channelInfo[chn].paired_ch; MSInfo *msInfoL = &(channelInfo[chn].msInfo); if (msInfoL->is_present) { int nsfb = coderInfo[chn].nr_of_sfb; int sfb; for (sfb = 0; sfb < nsfb; sfb++) { int l, start, end; start = coderInfo[chn].sfb_offset[sfb]; end = coderInfo[chn].sfb_offset[sfb + 1]; if (msInfoL->ms_used[sfb]) { for (l = start; l < end; l++) { double sum, diff; sum = coderInfo[chn].requantFreq[l]; diff = coderInfo[rch].requantFreq[l]; coderInfo[chn].requantFreq[l] = sum + diff; coderInfo[rch].requantFreq[l] = sum - diff; } } } } } } } } faac-1.28/libfaac/midside.h0000644010307701030770000000245507676646047017250 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2003 Krzysztof Nikiel * * 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 * * $Id: midside.h,v 1.1 2003/06/26 19:40:23 knik Exp $ */ #ifndef _MIDSIDE_H #define _MIDSIDE_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "coder.h" void MSEncode(CoderInfo *coderInfo, ChannelInfo *channelInfo, double *spectrum[MAX_CHANNELS], unsigned int numberOfChannels, unsigned int msenable); void MSReconstruct(CoderInfo *coderInfo, ChannelInfo *channelInfo, int numberOfChannels); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _MIDSIDE_H */ faac-1.28/libfaac/psych.h0000644010307701030770000000435610232770176016741 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: psych.h,v 1.14 2005/04/24 19:16:14 rjamorim Exp $ */ #ifndef PSYCH_H #define PSYCH_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #include "coder.h" #include "channels.h" #include "fft.h" typedef struct { int size; int sizeS; /* Previous input samples */ double *prevSamples; double *prevSamplesS; int block_type; void *data; } PsyInfo; typedef struct { double sampleRate; /* Hann window */ double *hannWindow; double *hannWindowS; void *data; } GlobalPsyInfo; typedef struct { void (*PsyInit) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo, unsigned int numChannels, unsigned int sampleRate, int *cb_width_long, int num_cb_long, int *cb_width_short, int num_cb_short); void (*PsyEnd) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo, unsigned int numChannels); void (*PsyCalculate) (ChannelInfo *channelInfo, GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo, int *cb_width_long, int num_cb_long, int *cb_width_short, int num_cb_short, unsigned int numChannels); void (*PsyBufferUpdate) ( FFT_Tables *fft_tables, GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo, double *newSamples, unsigned int bandwidth, int *cb_width_short, int num_cb_short); void (*BlockSwitch) (CoderInfo *coderInfo, PsyInfo *psyInfo, unsigned int numChannels); } psymodel_t; extern psymodel_t psymodel2; #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* PSYCH_H */faac-1.28/libfaac/psychkni.c0000644010307701030770000002614610232770176017437 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2002 Krzysztof Nikiel * * 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 * * $Id: psychkni.c,v 1.17 2005/04/24 19:16:14 rjamorim Exp $ */ #include #include #include #include "psych.h" #include "coder.h" #include "fft.h" #include "util.h" #include "frame.h" typedef float psyfloat; typedef struct { /* bandwidth */ int bandS; int lastband; /* SFB energy */ psyfloat *fftEnrgS[8]; psyfloat *fftEnrgNextS[8]; psyfloat *fftEnrgNext2S[8]; psyfloat *fftEnrgPrevS[8]; } psydata_t; static void Hann(GlobalPsyInfo * gpsyInfo, double *inSamples, int size) { int i; /* Applying Hann window */ if (size == BLOCK_LEN_LONG * 2) { for (i = 0; i < size; i++) inSamples[i] *= gpsyInfo->hannWindow[i]; } else { for (i = 0; i < size; i++) inSamples[i] *= gpsyInfo->hannWindowS[i]; } } static void PsyCheckShort(PsyInfo * psyInfo) { double totvol = 0.0; double totchg, totchg2; psydata_t *psydata = psyInfo->data; int lastband = psydata->lastband; int firstband = 1; int sfb; /* long/short block switch */ totchg = totchg2 = 0.0; for (sfb = 0; sfb < lastband; sfb++) { int win; double volb[16]; double vavg[13]; double maxdif = 0.0; double totmaxdif = 0.0; double e, v; // previous frame for (win = 0; win < 4; win++) { e = psydata->fftEnrgPrevS[win + 4][sfb]; volb[win] = sqrt(e); totvol += e; } // current frame for (win = 0; win < 8; win++) { e = psydata->fftEnrgS[win][sfb]; volb[win + 4] = sqrt(e); totvol += e; } // next frame for (win = 0; win < 4; win++) { e = psydata->fftEnrgNextS[win][sfb]; volb[win + 12] = sqrt(e); totvol += e; } // ignore lowest SFBs if (sfb < firstband) continue; v = 0.0; for (win = 0; win < 4; win++) { v += volb[win]; } vavg[0] = 0.25 * v; for (win = 1; win < 13; win++) { v -= volb[win - 1]; v += volb[win + 3]; vavg[win] = 0.25 * v; } for (win = 0; win < 8; win++) { int i; double mina, maxv; double voldif; double totvoldif; mina = vavg[win]; for (i = 1; i < 5; i++) mina = min(mina, vavg[win + i]); maxv = volb[win + 2]; for (i = 3; i < 6; i++) maxv = max(maxv, volb[win + i]); if (!maxv || !mina) continue; voldif = (maxv - mina) / mina; totvoldif = (maxv - mina) * (maxv - mina); if (voldif > maxdif) maxdif = voldif; if (totvoldif > totmaxdif) totmaxdif = totvoldif; } totchg += maxdif; totchg2 += totmaxdif; } totvol = sqrt(totvol); totchg2 = sqrt(totchg2); totchg = totchg / lastband; if (totvol) totchg2 /= totvol; else totchg2 = 0.0; psyInfo->block_type = ((totchg > 1.0) && (totchg2 > 0.04)) ? ONLY_SHORT_WINDOW : ONLY_LONG_WINDOW; #if 0 { static int total = 0, shorts = 0; char *flash = " "; total++; if (psyInfo->block_type == ONLY_SHORT_WINDOW) { flash = "****"; shorts++; } printf("totchg: %s %g %g\t%g\n", flash, totchg, totchg2, (double)shorts/total); } #endif } static void PsyInit(GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo, unsigned int numChannels, unsigned int sampleRate, int *cb_width_long, int num_cb_long, int *cb_width_short, int num_cb_short) { unsigned int channel; int i, j, size; gpsyInfo->hannWindow = (double *) AllocMemory(2 * BLOCK_LEN_LONG * sizeof(double)); gpsyInfo->hannWindowS = (double *) AllocMemory(2 * BLOCK_LEN_SHORT * sizeof(double)); for (i = 0; i < BLOCK_LEN_LONG * 2; i++) gpsyInfo->hannWindow[i] = 0.5 * (1 - cos(2.0 * M_PI * (i + 0.5) / (BLOCK_LEN_LONG * 2))); for (i = 0; i < BLOCK_LEN_SHORT * 2; i++) gpsyInfo->hannWindowS[i] = 0.5 * (1 - cos(2.0 * M_PI * (i + 0.5) / (BLOCK_LEN_SHORT * 2))); gpsyInfo->sampleRate = (double) sampleRate; for (channel = 0; channel < numChannels; channel++) { psydata_t *psydata = AllocMemory(sizeof(psydata_t)); psyInfo[channel].data = psydata; } size = BLOCK_LEN_LONG; for (channel = 0; channel < numChannels; channel++) { psyInfo[channel].size = size; psyInfo[channel].prevSamples = (double *) AllocMemory(size * sizeof(double)); memset(psyInfo[channel].prevSamples, 0, size * sizeof(double)); } size = BLOCK_LEN_SHORT; for (channel = 0; channel < numChannels; channel++) { psydata_t *psydata = psyInfo[channel].data; psyInfo[channel].sizeS = size; psyInfo[channel].prevSamplesS = (double *) AllocMemory(size * sizeof(double)); memset(psyInfo[channel].prevSamplesS, 0, size * sizeof(double)); for (j = 0; j < 8; j++) { psydata->fftEnrgPrevS[j] = (psyfloat *) AllocMemory(NSFB_SHORT * sizeof(psyfloat)); memset(psydata->fftEnrgPrevS[j], 0, NSFB_SHORT * sizeof(psyfloat)); psydata->fftEnrgS[j] = (psyfloat *) AllocMemory(NSFB_SHORT * sizeof(psyfloat)); memset(psydata->fftEnrgS[j], 0, NSFB_SHORT * sizeof(psyfloat)); psydata->fftEnrgNextS[j] = (psyfloat *) AllocMemory(NSFB_SHORT * sizeof(psyfloat)); memset(psydata->fftEnrgNextS[j], 0, NSFB_SHORT * sizeof(psyfloat)); psydata->fftEnrgNext2S[j] = (psyfloat *) AllocMemory(NSFB_SHORT * sizeof(psyfloat)); memset(psydata->fftEnrgNext2S[j], 0, NSFB_SHORT * sizeof(psyfloat)); } } } static void PsyEnd(GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo, unsigned int numChannels) { unsigned int channel; int j; if (gpsyInfo->hannWindow) FreeMemory(gpsyInfo->hannWindow); if (gpsyInfo->hannWindowS) FreeMemory(gpsyInfo->hannWindowS); for (channel = 0; channel < numChannels; channel++) { if (psyInfo[channel].prevSamples) FreeMemory(psyInfo[channel].prevSamples); } for (channel = 0; channel < numChannels; channel++) { psydata_t *psydata = psyInfo[channel].data; if (psyInfo[channel].prevSamplesS) FreeMemory(psyInfo[channel].prevSamplesS); for (j = 0; j < 8; j++) { if (psydata->fftEnrgPrevS[j]) FreeMemory(psydata->fftEnrgPrevS[j]); if (psydata->fftEnrgS[j]) FreeMemory(psydata->fftEnrgS[j]); if (psydata->fftEnrgNextS[j]) FreeMemory(psydata->fftEnrgNextS[j]); if (psydata->fftEnrgNext2S[j]) FreeMemory(psydata->fftEnrgNext2S[j]); } } for (channel = 0; channel < numChannels; channel++) { if (psyInfo[channel].data) FreeMemory(psyInfo[channel].data); } } /* Do psychoacoustical analysis */ static void PsyCalculate(ChannelInfo * channelInfo, GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo, int *cb_width_long, int num_cb_long, int *cb_width_short, int num_cb_short, unsigned int numChannels) { unsigned int channel; for (channel = 0; channel < numChannels; channel++) { if (channelInfo[channel].present) { if (channelInfo[channel].cpe && channelInfo[channel].ch_is_left) { /* CPE */ int leftChan = channel; int rightChan = channelInfo[channel].paired_ch; PsyCheckShort(&psyInfo[leftChan]); PsyCheckShort(&psyInfo[rightChan]); } else if (!channelInfo[channel].cpe && channelInfo[channel].lfe) { /* LFE */ // Only set block type and it should be OK psyInfo[channel].block_type = ONLY_LONG_WINDOW; } else if (!channelInfo[channel].cpe) { /* SCE */ PsyCheckShort(&psyInfo[channel]); } } } } static void PsyBufferUpdate( FFT_Tables *fft_tables, GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo, double *newSamples, unsigned int bandwidth, int *cb_width_short, int num_cb_short) { int win; double transBuff[2 * BLOCK_LEN_LONG]; double transBuffS[2 * BLOCK_LEN_SHORT]; psydata_t *psydata = psyInfo->data; psyfloat *tmp; int sfb; psydata->bandS = psyInfo->sizeS * bandwidth * 2 / gpsyInfo->sampleRate; memcpy(transBuff, psyInfo->prevSamples, psyInfo->size * sizeof(double)); memcpy(transBuff + psyInfo->size, newSamples, psyInfo->size * sizeof(double)); for (win = 0; win < 8; win++) { int first = 0; int last = 0; memcpy(transBuffS, transBuff + (win * BLOCK_LEN_SHORT) + (BLOCK_LEN_LONG - BLOCK_LEN_SHORT) / 2, 2 * psyInfo->sizeS * sizeof(double)); Hann(gpsyInfo, transBuffS, 2 * psyInfo->sizeS); rfft( fft_tables, transBuffS, 8); // shift bufs tmp = psydata->fftEnrgPrevS[win]; psydata->fftEnrgPrevS[win] = psydata->fftEnrgS[win]; psydata->fftEnrgS[win] = psydata->fftEnrgNextS[win]; psydata->fftEnrgNextS[win] = psydata->fftEnrgNext2S[win]; psydata->fftEnrgNext2S[win] = tmp; for (sfb = 0; sfb < num_cb_short; sfb++) { double e; int l; first = last; last = first + cb_width_short[sfb]; if (first < 1) first = 1; //if (last > psydata->bandS) // band out of range if (first >= psydata->bandS) // band out of range break; e = 0.0; for (l = first; l < last; l++) { double a = transBuffS[l]; double b = transBuffS[l + psyInfo->sizeS]; e += a * a + b * b; } psydata->fftEnrgNext2S[win][sfb] = e; } psydata->lastband = sfb; for (; sfb < num_cb_short; sfb++) { psydata->fftEnrgNext2S[win][sfb] = 0; } } memcpy(psyInfo->prevSamples, newSamples, psyInfo->size * sizeof(double)); } static void BlockSwitch(CoderInfo * coderInfo, PsyInfo * psyInfo, unsigned int numChannels) { unsigned int channel; int desire = ONLY_LONG_WINDOW; /* Use the same block type for all channels If there is 1 channel that wants a short block, use a short block on all channels. */ for (channel = 0; channel < numChannels; channel++) { if (psyInfo[channel].block_type == ONLY_SHORT_WINDOW) desire = ONLY_SHORT_WINDOW; } for (channel = 0; channel < numChannels; channel++) { int lasttype = coderInfo[channel].block_type; if (desire == ONLY_SHORT_WINDOW || coderInfo[channel].desired_block_type == ONLY_SHORT_WINDOW) { if (lasttype == ONLY_LONG_WINDOW || lasttype == SHORT_LONG_WINDOW) coderInfo[channel].block_type = LONG_SHORT_WINDOW; else coderInfo[channel].block_type = ONLY_SHORT_WINDOW; } else { if (lasttype == ONLY_SHORT_WINDOW || lasttype == LONG_SHORT_WINDOW) coderInfo[channel].block_type = SHORT_LONG_WINDOW; else coderInfo[channel].block_type = ONLY_LONG_WINDOW; } coderInfo[channel].desired_block_type = desire; } } psymodel_t psymodel2 = { PsyInit, PsyEnd, PsyCalculate, PsyBufferUpdate, BlockSwitch }; faac-1.28/libfaac/tns.c0000644010307701030770000005325307760444434016421 0ustar fabian-guestfabian-guest/********************************************************************** This software module was originally developed by Texas Instruments and edited by in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio standards. Those intending to use this software module in hardware or software products are advised that this use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third party from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1997. **********************************************************************/ /* * $Id: tns.c,v 1.10 2003/11/24 18:08:28 knik Exp $ */ #include #include "frame.h" #include "coder.h" #include "bitstream.h" #include "tns.h" #include "util.h" /***********************************************/ /* TNS Profile/Frequency Dependent Parameters */ /***********************************************/ static unsigned long tnsSupportedSamplingRates[13] = { 96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,0 }; /* Limit bands to > 2.0 kHz */ static unsigned short tnsMinBandNumberLong[12] = { 11, 12, 15, 16, 17, 20, 25, 26, 24, 28, 30, 31 }; static unsigned short tnsMinBandNumberShort[12] = { 2, 2, 2, 3, 3, 4, 6, 6, 8, 10, 10, 12 }; /**************************************/ /* Main/Low Profile TNS Parameters */ /**************************************/ static unsigned short tnsMaxBandsLongMainLow[12] = { 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39 }; static unsigned short tnsMaxBandsShortMainLow[12] = { 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; static unsigned short tnsMaxOrderLongMain = 20; static unsigned short tnsMaxOrderLongLow = 12; static unsigned short tnsMaxOrderShortMainLow = 7; /*************************/ /* Function prototypes */ /*************************/ static void Autocorrelation(int maxOrder, /* Maximum autocorr order */ int dataSize, /* Size of the data array */ double* data, /* Data array */ double* rArray); /* Autocorrelation array */ static double LevinsonDurbin(int maxOrder, /* Maximum filter order */ int dataSize, /* Size of the data array */ double* data, /* Data array */ double* kArray); /* Reflection coeff array */ static void StepUp(int fOrder, double* kArray, double* aArray); static void QuantizeReflectionCoeffs(int fOrder,int coeffRes,double* rArray,int* indexArray); static int TruncateCoeffs(int fOrder,double threshold,double* kArray); static void TnsFilter(int length,double* spec,TnsFilterData* filter); static void TnsInvFilter(int length,double* spec,TnsFilterData* filter); /*****************************************************/ /* InitTns: */ /*****************************************************/ void TnsInit(faacEncHandle hEncoder) { unsigned int channel; int fsIndex = hEncoder->sampleRateIdx; int profile = hEncoder->config.aacObjectType; for (channel = 0; channel < hEncoder->numChannels; channel++) { TnsInfo *tnsInfo = &hEncoder->coderInfo[channel].tnsInfo; switch( profile ) { case MAIN: case LTP: tnsInfo->tnsMaxBandsLong = tnsMaxBandsLongMainLow[fsIndex]; tnsInfo->tnsMaxBandsShort = tnsMaxBandsShortMainLow[fsIndex]; if (hEncoder->config.mpegVersion == 1) { /* MPEG2 */ tnsInfo->tnsMaxOrderLong = tnsMaxOrderLongMain; } else { /* MPEG4 */ if (fsIndex <= 5) /* fs > 32000Hz */ tnsInfo->tnsMaxOrderLong = 12; else tnsInfo->tnsMaxOrderLong = 20; } tnsInfo->tnsMaxOrderShort = tnsMaxOrderShortMainLow; break; case LOW : tnsInfo->tnsMaxBandsLong = tnsMaxBandsLongMainLow[fsIndex]; tnsInfo->tnsMaxBandsShort = tnsMaxBandsShortMainLow[fsIndex]; if (hEncoder->config.mpegVersion == 1) { /* MPEG2 */ tnsInfo->tnsMaxOrderLong = tnsMaxOrderLongLow; } else { /* MPEG4 */ if (fsIndex <= 5) /* fs > 32000Hz */ tnsInfo->tnsMaxOrderLong = 12; else tnsInfo->tnsMaxOrderLong = 20; } tnsInfo->tnsMaxOrderShort = tnsMaxOrderShortMainLow; break; } tnsInfo->tnsMinBandNumberLong = tnsMinBandNumberLong[fsIndex]; tnsInfo->tnsMinBandNumberShort = tnsMinBandNumberShort[fsIndex]; } } /*****************************************************/ /* TnsEncode: */ /*****************************************************/ void TnsEncode(TnsInfo* tnsInfo, /* TNS info */ int numberOfBands, /* Number of bands per window */ int maxSfb, /* max_sfb */ enum WINDOW_TYPE blockType, /* block type */ int* sfbOffsetTable, /* Scalefactor band offset table */ double* spec) /* Spectral data array */ { int numberOfWindows,windowSize; int startBand,stopBand,order; /* Bands over which to apply TNS */ int lengthInBands; /* Length to filter, in bands */ int w; int startIndex,length; double gain; switch( blockType ) { case ONLY_SHORT_WINDOW : /* TNS not used for short blocks currently */ tnsInfo->tnsDataPresent = 0; return; numberOfWindows = MAX_SHORT_WINDOWS; windowSize = BLOCK_LEN_SHORT; startBand = tnsInfo->tnsMinBandNumberShort; stopBand = numberOfBands; lengthInBands = stopBand-startBand; order = tnsInfo->tnsMaxOrderShort; startBand = min(startBand,tnsInfo->tnsMaxBandsShort); stopBand = min(stopBand,tnsInfo->tnsMaxBandsShort); break; default: numberOfWindows = 1; windowSize = BLOCK_LEN_SHORT; startBand = tnsInfo->tnsMinBandNumberLong; stopBand = numberOfBands; lengthInBands = stopBand - startBand; order = tnsInfo->tnsMaxOrderLong; startBand = min(startBand,tnsInfo->tnsMaxBandsLong); stopBand = min(stopBand,tnsInfo->tnsMaxBandsLong); break; } /* Make sure that start and stop bands < maxSfb */ /* Make sure that start and stop bands >= 0 */ startBand = min(startBand,maxSfb); stopBand = min(stopBand,maxSfb); startBand = max(startBand,0); stopBand = max(stopBand,0); tnsInfo->tnsDataPresent = 0; /* default TNS not used */ /* Perform analysis and filtering for each window */ for (w=0;wwindowData[w]; TnsFilterData* tnsFilter = windowData->tnsFilter; double* k = tnsFilter->kCoeffs; /* reflection coeffs */ double* a = tnsFilter->aCoeffs; /* prediction coeffs */ windowData->numFilters=0; windowData->coefResolution = DEF_TNS_COEFF_RES; startIndex = w * windowSize + sfbOffsetTable[startBand]; length = sfbOffsetTable[stopBand] - sfbOffsetTable[startBand]; gain = LevinsonDurbin(order,length,&spec[startIndex],k); if (gain>DEF_TNS_GAIN_THRESH) { /* Use TNS */ int truncatedOrder; windowData->numFilters++; tnsInfo->tnsDataPresent=1; tnsFilter->direction = 0; tnsFilter->coefCompress = 0; tnsFilter->length = lengthInBands; QuantizeReflectionCoeffs(order,DEF_TNS_COEFF_RES,k,tnsFilter->index); truncatedOrder = TruncateCoeffs(order,DEF_TNS_COEFF_THRESH,k); tnsFilter->order = truncatedOrder; StepUp(truncatedOrder,k,a); /* Compute predictor coefficients */ TnsInvFilter(length,&spec[startIndex],tnsFilter); /* Filter */ } } } /*****************************************************/ /* TnsEncodeFilterOnly: */ /* This is a stripped-down version of TnsEncode() */ /* which performs TNS analysis filtering only */ /*****************************************************/ void TnsEncodeFilterOnly(TnsInfo* tnsInfo, /* TNS info */ int numberOfBands, /* Number of bands per window */ int maxSfb, /* max_sfb */ enum WINDOW_TYPE blockType, /* block type */ int* sfbOffsetTable, /* Scalefactor band offset table */ double* spec) /* Spectral data array */ { int numberOfWindows,windowSize; int startBand,stopBand; /* Bands over which to apply TNS */ int w; int startIndex,length; switch( blockType ) { case ONLY_SHORT_WINDOW : numberOfWindows = MAX_SHORT_WINDOWS; windowSize = BLOCK_LEN_SHORT; startBand = tnsInfo->tnsMinBandNumberShort; stopBand = numberOfBands; startBand = min(startBand,tnsInfo->tnsMaxBandsShort); stopBand = min(stopBand,tnsInfo->tnsMaxBandsShort); break; default: numberOfWindows = 1; windowSize = BLOCK_LEN_LONG; startBand = tnsInfo->tnsMinBandNumberLong; stopBand = numberOfBands; startBand = min(startBand,tnsInfo->tnsMaxBandsLong); stopBand = min(stopBand,tnsInfo->tnsMaxBandsLong); break; } /* Make sure that start and stop bands < maxSfb */ /* Make sure that start and stop bands >= 0 */ startBand = min(startBand,maxSfb); stopBand = min(stopBand,maxSfb); startBand = max(startBand,0); stopBand = max(stopBand,0); /* Perform filtering for each window */ for(w=0;wwindowData[w]; TnsFilterData* tnsFilter = windowData->tnsFilter; startIndex = w * windowSize + sfbOffsetTable[startBand]; length = sfbOffsetTable[stopBand] - sfbOffsetTable[startBand]; if (tnsInfo->tnsDataPresent && windowData->numFilters) { /* Use TNS */ TnsInvFilter(length,&spec[startIndex],tnsFilter); } } } /*****************************************************/ /* TnsDecodeFilterOnly: */ /* This is a stripped-down version of TnsEncode() */ /* which performs TNS synthesis filtering only */ /*****************************************************/ void TnsDecodeFilterOnly(TnsInfo* tnsInfo, /* TNS info */ int numberOfBands, /* Number of bands per window */ int maxSfb, /* max_sfb */ enum WINDOW_TYPE blockType, /* block type */ int* sfbOffsetTable, /* Scalefactor band offset table */ double* spec) /* Spectral data array */ { int numberOfWindows,windowSize; int startBand,stopBand; /* Bands over which to apply TNS */ int w; int startIndex,length; switch( blockType ) { case ONLY_SHORT_WINDOW : numberOfWindows = MAX_SHORT_WINDOWS; windowSize = BLOCK_LEN_SHORT; startBand = tnsInfo->tnsMinBandNumberShort; stopBand = numberOfBands; startBand = min(startBand,tnsInfo->tnsMaxBandsShort); stopBand = min(stopBand,tnsInfo->tnsMaxBandsShort); break; default: numberOfWindows = 1; windowSize = BLOCK_LEN_LONG; startBand = tnsInfo->tnsMinBandNumberLong; stopBand = numberOfBands; startBand = min(startBand,tnsInfo->tnsMaxBandsLong); stopBand = min(stopBand,tnsInfo->tnsMaxBandsLong); break; } /* Make sure that start and stop bands < maxSfb */ /* Make sure that start and stop bands >= 0 */ startBand = min(startBand,maxSfb); stopBand = min(stopBand,maxSfb); startBand = max(startBand,0); stopBand = max(stopBand,0); /* Perform filtering for each window */ for(w=0;wwindowData[w]; TnsFilterData* tnsFilter = windowData->tnsFilter; startIndex = w * windowSize + sfbOffsetTable[startBand]; length = sfbOffsetTable[stopBand] - sfbOffsetTable[startBand]; if (tnsInfo->tnsDataPresent && windowData->numFilters) { /* Use TNS */ TnsFilter(length,&spec[startIndex],tnsFilter); } } } /*****************************************************/ /* TnsFilter: */ /* Filter the given spec with specified length */ /* using the coefficients specified in filter. */ /* Not that the order and direction are specified */ /* withing the TNS_FILTER_DATA structure. */ /*****************************************************/ static void TnsFilter(int length,double* spec,TnsFilterData* filter) { int i,j,k=0; int order=filter->order; double* a=filter->aCoeffs; /* Determine loop parameters for given direction */ if (filter->direction) { /* Startup, initial state is zero */ for (i=length-2;i>(length-1-order);i--) { k++; for (j=1;j<=k;j++) { spec[i]-=spec[i+j]*a[j]; } } /* Now filter completely inplace */ for (i=length-1-order;i>=0;i--) { for (j=1;j<=order;j++) { spec[i]-=spec[i+j]*a[j]; } } } else { /* Startup, initial state is zero */ for (i=1;iorder; double* a=filter->aCoeffs; double* temp; temp = (double *)AllocMemory(length * sizeof (double)); /* Determine loop parameters for given direction */ if (filter->direction) { /* Startup, initial state is zero */ temp[length-1]=spec[length-1]; for (i=length-2;i>(length-1-order);i--) { temp[i]=spec[i]; k++; for (j=1;j<=k;j++) { spec[i]+=temp[i+j]*a[j]; } } /* Now filter the rest */ for (i=length-1-order;i>=0;i--) { temp[i]=spec[i]; for (j=1;j<=order;j++) { spec[i]+=temp[i+j]*a[j]; } } } else { /* Startup, initial state is zero */ temp[0]=spec[0]; for (i=1;i= 0; i--) { kArray[i] = (fabs(kArray[i])>threshold) ? kArray[i] : 0.0; if (kArray[i]!=0.0) return i; } return 0; } /*****************************************************/ /* QuantizeReflectionCoeffs: */ /* Quantize the given array of reflection coeffs */ /* to the specified resolution in bits. */ /*****************************************************/ static void QuantizeReflectionCoeffs(int fOrder, int coeffRes, double* kArray, int* indexArray) { double iqfac,iqfac_m; int i; iqfac = ((1<<(coeffRes-1))-0.5)/(M_PI/2); iqfac_m = ((1<<(coeffRes-1))+0.5)/(M_PI/2); /* Quantize and inverse quantize */ for (i=1;i<=fOrder;i++) { indexArray[i] = (int)(0.5+(asin(kArray[i])*((kArray[i]>=0)?iqfac:iqfac_m))); kArray[i] = sin((double)indexArray[i]/((indexArray[i]>=0)?iqfac:iqfac_m)); } } /*****************************************************/ /* Autocorrelation, */ /* Compute the autocorrelation function */ /* estimate for the given data. */ /*****************************************************/ static void Autocorrelation(int maxOrder, /* Maximum autocorr order */ int dataSize, /* Size of the data array */ double* data, /* Data array */ double* rArray) /* Autocorrelation array */ { int order,index; for (order=0;order<=maxOrder;order++) { rArray[order]=0.0; for (index=0;index #include "util.h" #include "coder.h" // FRAME_LEN /* Returns the sample rate index */ int GetSRIndex(unsigned int sampleRate) { if (92017 <= sampleRate) return 0; if (75132 <= sampleRate) return 1; if (55426 <= sampleRate) return 2; if (46009 <= sampleRate) return 3; if (37566 <= sampleRate) return 4; if (27713 <= sampleRate) return 5; if (23004 <= sampleRate) return 6; if (18783 <= sampleRate) return 7; if (13856 <= sampleRate) return 8; if (11502 <= sampleRate) return 9; if (9391 <= sampleRate) return 10; return 11; } /* Returns the maximum bitrate per channel for that sampling frequency */ unsigned int MaxBitrate(unsigned long sampleRate) { /* * Maximum of 6144 bit for a channel */ return (unsigned int)(6144.0 * (double)sampleRate/(double)FRAME_LEN + .5); } /* Returns the minimum bitrate per channel for that sampling frequency */ unsigned int MinBitrate() { return 8000; } /* Max prediction band for backward predictionas function of fs index */ const int MaxPredSfb[] = { 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 0 }; int GetMaxPredSfb(int samplingRateIdx) { return MaxPredSfb[samplingRateIdx]; } /* Calculate bit_allocation based on PE */ unsigned int BitAllocation(double pe, int short_block) { double pew1; double pew2; double bit_allocation; if (short_block) { pew1 = 0.6; pew2 = 24.0; } else { pew1 = 0.3; pew2 = 6.0; } bit_allocation = pew1 * pe + pew2 * sqrt(pe); bit_allocation = min(max(0.0, bit_allocation), 6144.0); return (unsigned int)(bit_allocation+0.5); } /* Returns the maximum bit reservoir size */ unsigned int MaxBitresSize(unsigned long bitRate, unsigned long sampleRate) { return 6144 - (unsigned int)((double)bitRate/(double)sampleRate*(double)FRAME_LEN); } faac-1.28/libfaac/util.h0000644010307701030770000000327207770750360016572 0ustar fabian-guestfabian-guest/* * FAAC - Freeware Advanced Audio Coder * Copyright (C) 2001 Menno Bakker * * 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 * * $Id: util.h,v 1.8 2003/12/20 04:32:48 stux Exp $ */ #ifndef UTIL_H #define UTIL_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include #include #ifndef max #define max(a, b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* Memory functions */ #define AllocMemory(size) malloc(size) #define FreeMemory(block) free(block) #define SetMemory(block, value, size) memset(block, value, size) int GetSRIndex(unsigned int sampleRate); int GetMaxPredSfb(int samplingRateIdx); unsigned int MaxBitrate(unsigned long sampleRate); unsigned int MinBitrate(); unsigned int MaxBitresSize(unsigned long bitRate, unsigned long sampleRate); unsigned int BitAllocation(double pe, int short_block); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* UTIL_H */ faac-1.28/libfaac/version.h0000644010307701030770000000014511141700735017262 0ustar fabian-guestfabian-guest#ifndef _VERSION_H_ #define _VERSION_H_ #define FAAC_RELEASE 1 #define FAAC_VERSION "1.28" #endif faac-1.28/plugins/0000755010307701030770000000000011144236237015530 5ustar fabian-guestfabian-guestfaac-1.28/plugins/cooledit/0000755010307701030770000000000011144236237017332 5ustar fabian-guestfabian-guestfaac-1.28/plugins/cooledit/FAAC.def0000644010307701030770000000045407711433537020516 0ustar fabian-guestfabian-guestLIBRARY EXPORTS QueryCoolFilter OpenFilterOutput CloseFilterOutput WriteFilterOutput OpenFilterInput CloseFilterInput ReadFilterInput FilterUnderstandsFormat FilterGetFileSize FilterOptionsString FilterGetOptions GetSuggestedSampleType ; DIALOGMsgProc ; FilterOptions ; FilterSetOptions faac-1.28/plugins/cooledit/Copying0000644010307701030770000004307607546051413020701 0ustar fabian-guestfabian-guest GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, 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 Appendix: 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. Copyright (C) 19yy 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. 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) 19yy 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. , 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. faac-1.28/plugins/cooledit/FAAC.sln0000644010307701030770000000501611137146035020542 0ustar fabian-guestfabian-guest Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FAAC", "FAAC.vcproj", "{DEC2740A-F3D5-430C-BB81-C57006D20378}" ProjectSection(ProjectDependencies) = postProject {2E6FD2E8-55B9-4740-8882-CF823F77F7E1} = {2E6FD2E8-55B9-4740-8882-CF823F77F7E1} {429A062F-81E0-4EFD-832B-55E0DE931FC8} = {429A062F-81E0-4EFD-832B-55E0DE931FC8} {BD8FBE75-314D-476B-B13C-A206C52F0BD1} = {BD8FBE75-314D-476B-B13C-A206C52F0BD1} {7F01A591-0084-4749-B53F-F9D2BFE8DF6E} = {7F01A591-0084-4749-B53F-F9D2BFE8DF6E} {6440BFC6-57A6-4F6E-A8FB-F960D088ADEE} = {6440BFC6-57A6-4F6E-A8FB-F960D088ADEE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aacInfoLib", "aacInfoLib.vcproj", "{3257D980-5029-486B-94DC-AA520B501C62}" EndProject Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "id3lib", "..\..\..\faad2\common\id3lib\libprj\id3lib.dsp", "{7F01A591-0084-4749-B53F-F9D2BFE8DF6E}" EndProject Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "libfaac", "..\..\libfaac\libfaac.dsp", "{2E6FD2E8-55B9-4740-8882-CF823F77F7E1}" EndProject Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "libfaad", "..\..\..\faad2\libfaad\libfaad.dsp", "{429A062F-81E0-4EFD-832B-55E0DE931FC8}" EndProject Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "libmp4v2_st", "..\..\..\faad2\common\mp4v2\libmp4v2_st60.dsp", "{BD8FBE75-314D-476B-B13C-A206C52F0BD1}" EndProject Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "zlib", "..\..\..\faad2\common\id3lib\zlib\prj\zlib.dsp", "{6440BFC6-57A6-4F6E-A8FB-F960D088ADEE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DEC2740A-F3D5-430C-BB81-C57006D20378}.Debug|Win32.ActiveCfg = Debug|Win32 {DEC2740A-F3D5-430C-BB81-C57006D20378}.Debug|Win32.Build.0 = Debug|Win32 {DEC2740A-F3D5-430C-BB81-C57006D20378}.Release|Win32.ActiveCfg = Release|Win32 {DEC2740A-F3D5-430C-BB81-C57006D20378}.Release|Win32.Build.0 = Release|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Debug|Win32.ActiveCfg = Debug|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Debug|Win32.Build.0 = Debug|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Release|Win32.ActiveCfg = Release|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/plugins/cooledit/FAAC.vcproj0000644010307701030770000002617011137146036021256 0ustar fabian-guestfabian-guest faac-1.28/plugins/cooledit/Faac.cpp0000644010307701030770000000646510137443613020702 0ustar fabian-guestfabian-guest/* FAAC - codec plugin for Cooledit Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include #include "resource.h" #include "filters.h" // CoolEdit #include "Defines.h" // my defines #include "EncDialog.h" #include "Cfaac.h" // ********************************************************************************************* inline DWORD ERROR_FGO(char *msg) { if(msg) { char buf[100]; sprintf(buf,"FilterGetOptions: %s", msg); MessageBox(0, buf, APP_NAME " plugin", MB_OK|MB_ICONSTOP); } return 0; } // ----------------------------------------------------------------------------------------------- DWORD FAR PASCAL FilterGetOptions(HWND hWnd, HINSTANCE hInst, long lSamprate, WORD wChannels, WORD wBitsPerSample, DWORD dwOptions) { long retVal=DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_ENCODER), (HWND)hWnd, (DLGPROC)DIALOGMsgProcEnc, dwOptions); if(retVal==-1) /*return */ERROR_FGO("DialogBoxParam"); return !retVal ? dwOptions : retVal; } // ********************************************************************************************* // GetSuggestedSampleType() is called if OpenFilterOutput() returns NULL void FAR PASCAL GetSuggestedSampleType(LONG *lplSamprate, WORD *lpwBitsPerSample, WORD *wChannels) { *lplSamprate=0; // don't care *lpwBitsPerSample= *lpwBitsPerSample<=16 ? 0 : 16; *wChannels= *wChannels<49 ? 0 : 48; } // ********************************************************************************************* void FAR PASCAL CloseFilterOutput(HANDLE hOutput) { if(!hOutput) return; Cfaac tmp(hOutput); // this line frees memory } // ********************************************************************************************* HANDLE FAR PASCAL OpenFilterOutput(LPSTR lpstrFilename,long lSamprate,WORD wBitsPerSample,WORD wChannels,long lSize, long far *lpChunkSize, DWORD dwOptions) { HANDLE hOutput; Cfaac tmp; CMyEncCfg cfg(false); char *srcFilename=tmp.getSourceFilename(cfg.TagSrcPath,lpstrFilename,cfg.TagSrcExt); if(hOutput=tmp.Init(srcFilename,lpstrFilename,lSamprate,wBitsPerSample,wChannels,lSize)) { MYOUTPUT *mo; GLOBALLOCK(mo,hOutput,MYOUTPUT,return NULL); *lpChunkSize=mo->samplesInput*(wBitsPerSample>>3); // size of samplesInput GlobalUnlock(hOutput); tmp.hOutput=NULL; } FREE_ARRAY(srcFilename); return hOutput; } // ********************************************************************************************* DWORD FAR PASCAL WriteFilterOutput(HANDLE hOutput, unsigned char far *bufIn, long lBytes) { if(!hOutput) return 0; Cfaac tmp; DWORD bytesWritten; bytesWritten=tmp.processData(hOutput,bufIn,lBytes); return bytesWritten ? bytesWritten : 0x7fffffff; // bytesWritten<=0 stops CoolEdit } faac-1.28/plugins/cooledit/Faad.cpp0000644010307701030770000001331510073204211020657 0ustar fabian-guestfabian-guest/* FAAC - codec plugin for Cooledit Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include //#include "resource.h" #include "filters.h" // CoolEdit #include "DecDialog.h" #include "Cfaad.h" // ********************************************************************************************* BOOL FAR PASCAL FilterUnderstandsFormat(LPSTR filename) { WORD len; if((len=lstrlen(filename))>4 && (!strcmpi(filename+len-4,".aac") || !strcmpi(filename+len-4,".mp4") || !strcmpi(filename+len-4,".m4a"))) return TRUE; return FALSE; } // ********************************************************************************************* long FAR PASCAL FilterGetFileSize(HANDLE hInput) { if(!hInput) return 0; DWORD dst_size; MYINPUT *mi; GLOBALLOCK(mi,hInput,MYINPUT,return 0); dst_size=mi->dst_size; GlobalUnlock(hInput); return dst_size; } // ********************************************************************************************* DWORD FAR PASCAL FilterOptionsString(HANDLE hInput, LPSTR szString) { if(!hInput) { lstrcpy(szString,""); return 0; } MYINPUT *mi; GLOBALLOCK(mi,hInput,MYINPUT,return 0); sprintf(szString,"MPEG%d - %lu bps\n", mi->file_info.version ? 4 : 2, mi->file_info.bitrate); if(mi->IsMP4) // MP4 file -------------------------------------------------------------------- lstrcat(szString,mpeg4AudioNames[mi->type]); else // AAC file ----------------------------------------------------------------------------- { switch(mi->file_info.headertype) { case RAW: sprintf(szString,"MPEG%d\nRaw\n", mi->file_info.version ? 4 : 2); lstrcat(szString,mpeg4AudioNames[mi->file_info.object_type]); GlobalUnlock(hInput); return 1;//0; // call FilterGetOptions() case ADIF: lstrcat(szString,"ADIF\n"); break; case ADTS: lstrcat(szString,"ADTS\n"); break; } lstrcat(szString,mpeg4AudioNames[mi->file_info.object_type]); /* switch(mi->file_info.object_type) { case MAIN: lstrcat(szString,"Main"); break; case LC: lstrcat(szString,"LC (Low Complexity)"); break; case SSR: lstrcat(szString,"SSR (unsupported)"); break; case LTP: lstrcat(szString,"LTP (Long Term Prediction)"); break; case HE_AAC: lstrcat(szString,"HE (High Efficiency)"); break; }*/ } GlobalUnlock(hInput); return 1; // don't call FilterGetOptions() } // ********************************************************************************************* /* DWORD FAR PASCAL FilterOptions(HANDLE hInput) { // FilterGetOptions() is called if this function and FilterSetOptions() are exported and FilterOptionsString() returns 0 // FilterSetOptions() is called only if this function is exported and and it returns 0 return 1; } // --------------------------------------------------------------------------------------------- DWORD FAR PASCAL FilterSetOptions(HANDLE hInput, DWORD dwOptions, LONG lSamprate, WORD wChannels, WORD wBPS) { return dwOptions; }*/ // ********************************************************************************************* void FAR PASCAL CloseFilterInput(HANDLE hInput) { if(!hInput) return; /* if(mi->file_info.headertype==RAW) { CRegistry reg; if(reg.openCreateReg(HKEY_CURRENT_USER,REGISTRY_PROGRAM_NAME "\\FAAD")) reg.setRegBool("OpenDialog",FALSE); else MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP); }*/ Cfaad tmp(hInput); } // ********************************************************************************************* #define ERROR_OFI(msg) \ { \ if(msg) \ MessageBox(0, msg, APP_NAME " plugin", MB_OK|MB_ICONSTOP); \ if(hInput) \ { \ GlobalUnlock(hInput); \ CloseFilterInput(hInput); \ } \ return 0; \ } // ----------------------------------------------------------------------------------------------- // return handle that will be passed in to close, and write routines HANDLE FAR PASCAL OpenFilterInput(LPSTR lpstrFilename, long far *lSamprate, WORD far *wBitsPerSample, WORD far *wChannels, HWND hWnd, long far *lChunkSize) { HANDLE hInput=NULL; Cfaad tmp; CMyDecCfg cfg(false); if(!*lSamprate && !tmp.IsMP4(lpstrFilename)) { /* aac_buffer b; float fLength; int bitrate; DWORD headertype; tmp.GetAACInfos(lpstrFilename,&b,&headertype,&fLength,&bitrate); if(headertype==RAW) tmp.ShowDlg4RawAAC=ShowDlg4RawAAC;*/ DWORD *seek_table; int seek_table_length; faadAACInfo file_info; if(!get_AAC_format(lpstrFilename, &file_info, &seek_table, &seek_table_length, 0)) if(file_info.headertype==RAW) tmp.ShowDlg4RawAAC=ShowDlg4RawAAC; } if(hInput=tmp.getInfos(lpstrFilename)) { MYINPUT *mi; GLOBALLOCK(mi,hInput,MYINPUT,return NULL); *wChannels=(WORD)mi->Channels; *lSamprate=mi->Samprate; *wBitsPerSample=mi->BitsPerSample; *lChunkSize=(*wBitsPerSample/8)*1024**wChannels*2; GlobalUnlock(hInput); tmp.hInput=NULL; } return hInput; } // ********************************************************************************************* DWORD FAR PASCAL ReadFilterInput(HANDLE hInput, unsigned char far *bufout, long lBytes) { if(!hInput) return 0; Cfaad tmp; return tmp.processData(hInput,bufout,lBytes); } faac-1.28/plugins/cooledit/Main.cpp0000644010307701030770000001006710073204211020711 0ustar fabian-guestfabian-guest/* FAAC - codec plugin for Cooledit Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #include #include "resource.h" #include "filters.h" //CoolEdit //#include "faac.h" #include "Defines.h" // my defines // Plugins of CoolEdit can be unloaded between each call of its exported funcs, // that's why no global variables can be used HINSTANCE hInstance=NULL; HBITMAP hBmBrowse=NULL; BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: hInstance=(HINSTANCE)hModule; if(!hBmBrowse) hBmBrowse=(HBITMAP)LoadImage(hInstance,MAKEINTRESOURCE(IDB_BROWSE),IMAGE_BITMAP,0,0,/*LR_CREATEDIBSECTION|*/LR_LOADTRANSPARENT|LR_LOADMAP3DCOLORS); /* Code from LibMain inserted here. Return TRUE to keep the DLL loaded or return FALSE to fail loading the DLL. You may have to modify the code in your original LibMain to account for the fact that it may be called more than once. You will get one DLL_PROCESS_ATTACH for each process that loads the DLL. This is different from LibMain which gets called only once when the DLL is loaded. The only time this is critical is when you are using shared data sections. If you are using shared data sections for statically allocated data, you will need to be careful to initialize it only once. Check your code carefully. Certain one-time initializations may now need to be done for each process that attaches. You may also not need code from your original LibMain because the operating system may now be doing it for you. */ break; case DLL_THREAD_ATTACH: /* Called each time a thread is created in a process that has already loaded (attached to) this DLL. Does not get called for each thread that exists in the process before it loaded the DLL. Do thread-specific initialization here. */ break; case DLL_THREAD_DETACH: /* Same as above, but called when a thread in the process exits. Do thread-specific cleanup here. */ break; case DLL_PROCESS_DETACH: /* Code from _WEP inserted here. This code may (like the LibMain) not be necessary. Check to make certain that the operating system is not doing it for you. */ hInstance=NULL; if(hBmBrowse) { DeleteObject(hBmBrowse); hBmBrowse=NULL; } break; } /* The return value is only used for DLL_PROCESS_ATTACH; all other conditions are ignored. */ return TRUE; // successful DLL_PROCESS_ATTACH } // Fill COOLQUERY structure with information regarding this file filter short FAR PASCAL QueryCoolFilter(COOLQUERY far * cq) { lstrcpy(cq->szName, APP_NAME); lstrcpy(cq->szCopyright, APP_NAME " codec"); lstrcpy(cq->szExt,"AAC"); lstrcpy(cq->szExt2,"MP4"); lstrcpy(cq->szExt3,"M4A"); cq->lChunkSize=16384; cq->dwFlags=QF_RATEADJUSTABLE|QF_CANLOAD|QF_CANSAVE|QF_HASOPTIONSBOX|QF_CANDO32BITFLOATS; cq->Mono8=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Mono12=0; // no support cq->Mono16=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Mono24=0; cq->Mono32=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Stereo8=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Stereo12=0; cq->Stereo16=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Stereo24=0; cq->Stereo32=R_5500|R_11025|R_22050|R_32075|R_44100|R_48000; cq->Quad8=0; cq->Quad16=0; cq->Quad32=0; return C_VALIDLIBRARY; } faac-1.28/plugins/cooledit/Readme.txt0000644010307701030770000000246210137443613021273 0ustar fabian-guestfabian-guest+-----------------------------------------------------------------+ | | | Cooledit/Audition plugin | | ------------------------ | | | +-----------------------------------------------------------------+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. ---------------------------------------------------------------------------- FAAC is a codec plugin for Cooledit/Audition to import and export .aac/.mp4 files. To use it: ---------- 1) put FAAC and FAAD2 packages into the same folder; 2) open the project, set "Active Configuration = FAAC - win32 Release" and compile; 3) copy FAAC.flt into CoolEdit folder and delete flt.dat To write .mp4 files: -------------------- Select "Write .mp4" in the config dialog or append .mp4 extension to the name of file in the "Save waveform as" dialog. ---------------------------------------------------------------------------- For suggestions, bugs report, etc., you can contact me at ntnfrn_email-temp@yahoo.it faac-1.28/plugins/cooledit/aacInfoLib.sln0000644010307701030770000000154011137146036022036 0ustar fabian-guestfabian-guest Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aacInfoLib", "aacInfoLib.vcproj", "{3257D980-5029-486B-94DC-AA520B501C62}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3257D980-5029-486B-94DC-AA520B501C62}.Debug|Win32.ActiveCfg = Debug|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Debug|Win32.Build.0 = Debug|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Release|Win32.ActiveCfg = Release|Win32 {3257D980-5029-486B-94DC-AA520B501C62}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal faac-1.28/plugins/cooledit/aacInfoLib.vcproj0000644010307701030770000001161211137146036022546 0ustar fabian-guestfabian-guest faac-1.28/plugins/cooledit/defines.h0000644010307701030770000000254610142153742021123 0ustar fabian-guestfabian-guest/* FAAC - codec plugin for Cooledit Copyright (C) 2002-2004 Antonio Foranna 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. 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. The author can be contacted at: ntnfrn_email-temp@yahoo.it */ #define APP_NAME "MPEG4-AAC" #define APP_VER "v2.6" #define REGISTRY_PROGRAM_NAME "SOFTWARE\\4N\\CoolEdit\\AAC-MPEG4" //#define USE_OUTPUT_FOLDER #define USE_IMPORT_TAG #define USE_PATHEXT // ********************************************************************************************* #define FREE_ARRAY(ptr) \ { \ if(ptr!=NULL) \ free(ptr); \ ptr=NULL; \ } // ----------------------------------------------------------------------------------------------- #define GLOBALLOCK(ptr,handle,type,ret) \ { \ if(!(ptr=(type *)GlobalLock(handle))) \ { \ MessageBox(0, "GlobalLock", APP_NAME " plugin", MB_OK|MB_ICONSTOP); \ ret; \ } \ } faac-1.28/plugins/cooledit/filters.h0000644010307701030770000001070007361266050021153 0ustar fabian-guestfabian-guest////////////////////////////////////////////////////// // GENERAL PURPOSE DEFS FOR CREATING CUSTOM FILTERS // ////////////////////////////////////////////////////// typedef struct riffspecialdata_t { HANDLE hSpecialData; HANDLE hData; // Actual data handle DWORD dwSize; // size of data in handle DWORD dwExtra; // optional extra data (usually a count) char szListType[8]; // Parent list type (usually "WAVE" or "INFO", or "adtl") char szType[8]; // Usually a four character code for data, but can be up to 7 chars } SPECIALDATA; // "CUE " dwExtra=number of cues, each cue is 8 bytes ([4] name [4] sample offset) // "LTXT" dwExtra=number of items, each one is 8 bytes ([4] ltxt len [4] name [4] cue length [4] purpose [n] data) // "NOTE" dwExtra=number of strings, each one is n bytes ([4] name [n-4] length zero term) // "LABL" dwExtra=number of strings, each one is n bytes ([4] name [n-4] length zero term) // "PLST" dwExtra=number if items, each one is 16 bytes ([4] name [4] dwLen [4] dwLoops [4] dwMode) // For special data, .FLT must implement FilterGetFirstSpecialData and FilterGetNextSpecialData typedef DWORD FOURCC; // a four character code struct cue_type { DWORD dwName; DWORD dwPosition; FOURCC fccChunk; DWORD dwChunkStart; DWORD dwBlockStart; DWORD dwSampleOffset; }; struct play_type {DWORD dwName; DWORD dwLength; DWORD dwLoops; }; typedef struct coolquery_tag {char szName[24]; char szCopyright[80]; // rate table, bits are set for modes that can be handled WORD Quad32; // Quads are 3-D encoded WORD Quad16; WORD Quad8; WORD Stereo8; // rates are from lowest bit: WORD Stereo12; // bit 0 set: 5500 (5512.5) WORD Stereo16; // bit 1 set: 11025 (11K) WORD Stereo24; // bit 2 set: 22050 (22K) WORD Stereo32; // bit 3 set: 32075 (32K, or 32000) WORD Mono8; // bit 4 set: 44100 (44K) WORD Mono12; // bit 5 set: 48000 (48K) WORD Mono16; // bit 6 set: 88200 (88K) (future ultra-sonic rates?) WORD Mono24; // bit 7 set: 96000 (96K) WORD Mono32; // bit 8 set: 132300 (132K) // bit 9 set: 176400 (176K) DWORD dwFlags; char szExt[4]; long lChunkSize; char szExt2[4]; char szExt3[4]; char szExt4[4]; } COOLQUERY; #define R_5500 1 #define R_11025 2 #define R_22050 4 #define R_32075 8 #define R_44100 16 #define R_48000 32 #define R_88200 64 #define R_96000 128 #define R_132300 256 #define R_176400 512 #define C_VALIDLIBRARY 1154 #define QF_RATEADJUSTABLE 0x001 // if can handle non-standard sample rates // if not, only rates in bit rate table understood #define QF_CANSAVE 0x002 #define QF_CANLOAD 0x004 #define QF_UNDERSTANDSALL 0x008 // will read ANYTHING, so it is the last resort if no other // formats match #define QF_READSPECIALFIRST 0x010 // read special info before trying to read data #define QF_READSPECIALLAST 0x020 // read special info after reading data #define QF_WRITESPECIALFIRST 0x040 // when writing a file, special info is sent to DLL before data #define QF_WRITESPECIALLAST 0x080 // when writing, special info is sent to DLL after data #define QF_HASOPTIONSBOX 0x100 // set if options box implemented #define QF_NOASKFORCONVERT 0x200 // set to bypass asking for conversion if original in different rate, auto convert #define QF_NOHEADER 0x400 // set if this is a raw data format with no header #define QF_CANDO32BITFLOATS 0x800 // set if file format can handle 32-bit sample data for input #define QF_CANOPENVIRTUAL 0x1000 // Set if data is in Intel 8-bit or 16-bit sample format, or floats // and the GetDataOffset() function is implemented // special types are read from and written to DLL in the order below /* // special types (particular to Windows waveforms) #define SP_IART 20 #define SP_ICMT 21 #define SP_ICOP 22 #define SP_ICRD 23 #define SP_IENG 24 #define SP_IGNR 25 #define SP_IKEY 26 #define SP_IMED 27 #define SP_INAM 28 #define SP_ISFT 29 #define SP_ISRC 30 #define SP_ITCH 31 #define SP_ISBJ 32 #define SP_ISRF 33 #define SP_DISP 34 #define SP_CUE 40 // returns number of cues of size cue_type #define SP_LTXT 41 // returns number of adtl texts of size 8 (4,id and 4,len) #define SP_NOTE 42 // returns LO=size, HI=number of strings (sz sz sz...) #define SP_LABL 43 // returns LO=size, HI=number of strings (sz sz sz...) #define SP_PLST 44 // returns number of playlist entries size play_type */faac-1.28/project/0000755010307701030770000000000011144236237015515 5ustar fabian-guestfabian-guestfaac-1.28/project/lcc/0000755010307701030770000000000011144236237016256 5ustar fabian-guestfabian-guestfaac-1.28/project/lcc/Makefile0000644010307701030770000005423607366334600017734 0ustar fabian-guestfabian-guest# Makefile for project faac # Edit this path to let it point to the location of the source on your HDD SRCDIR=d:\aac\cvsrep\faac # Edit this path to let it point to the location of your LCC installation LCCDIR=c:\lcc # No editing needed after this point CFLAGS=-I$(LCCDIR)\include -I$(SRCDIR)\include -I$(SRCDIR)\common\getopt -I$(SRCDIR)\common\libsndfile\win32 -I$(SRCDIR)\common\libsndfile\src -O CC=$(LCCDIR)\bin\lcc.exe LINKER=$(LCCDIR)\bin\lcclnk.exe OBJS=\ getopt.obj \ aiff.obj \ alaw.obj \ au.obj \ au_g72x.obj \ common.obj \ g721.obj \ g723_16.obj \ g723_24.obj \ g723_40.obj \ g72x.obj \ add.obj \ code.obj \ decode.obj \ gsm_create.obj \ gsm_decode.obj \ gsm_destroy.obj \ gsm_encode.obj \ gsm_option.obj \ long_term.obj \ lpc.obj \ preprocess.obj \ rpe.obj \ short_term.obj \ table.obj \ newpcm.obj \ paf.obj \ pcm.obj \ raw.obj \ sndfile.obj \ svx.obj \ ulaw.obj \ wav.obj \ wav_float.obj \ wav_gsm610.obj \ wav_ima_adpcm.obj \ wav_ms_adpcm.obj \ main.obj \ aacquant.obj \ backpred.obj \ bitstream.obj \ channels.obj \ fft.obj \ filtbank.obj \ frame.obj \ huffman.obj \ joint.obj \ ltp.obj \ psych.obj \ tns.obj \ util.obj LIBS= faac.exe: $(OBJS) Makefile $(LINKER) -s -subsystem console -o $(SRCDIR)\lcc\faac.exe $(OBJS) $(LIBS) # Build GETOPT.C GETOPT_C=\ $(SRCDIR)\common\getopt\getopt.h\ getopt.obj: $(GETOPT_C) $(SRCDIR)\common\getopt\getopt.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\getopt\getopt.c # Build AIFF.C AIFF_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ aiff.obj: $(AIFF_C) $(SRCDIR)\common\libsndfile\src\aiff.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\aiff.c # Build ALAW.C ALAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ alaw.obj: $(ALAW_C) $(SRCDIR)\common\libsndfile\src\alaw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\alaw.c # Build AU.C AU_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ $(SRCDIR)\common\libsndfile\src\au.h\ $(SRCDIR)\common\libsndfile\src\ulaw.h\ $(SRCDIR)\common\libsndfile\src\alaw.h\ au.obj: $(AU_C) $(SRCDIR)\common\libsndfile\src\au.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\au.c # Build AU_G72X.C AU_G72X_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\au.h\ $(SRCDIR)\common\libsndfile\src\G72x\g72x.h\ au_g72x.obj: $(AU_G72X_C) $(SRCDIR)\common\libsndfile\src\au_g72x.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\au_g72x.c # Build COMMON.C COMMON_C=\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ common.obj: $(COMMON_C) $(SRCDIR)\common\libsndfile\src\common.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\common.c # Build G721.C G721_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g721.obj: $(G721_C) $(SRCDIR)\common\libsndfile\src\g72x\g721.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g721.c # Build G723_16.C G723_16_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_16.obj: $(G723_16_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_16.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_16.c # Build G723_24.C G723_24_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_24.obj: $(G723_24_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_24.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_24.c # Build G723_40.C G723_40_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_40.obj: $(G723_40_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_40.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_40.c # Build G72X.C G72X_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g72x.obj: $(G72X_C) $(SRCDIR)\common\libsndfile\src\g72x\g72x.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g72x.c # Build ADD.C ADD_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ add.obj: $(ADD_C) $(SRCDIR)\common\libsndfile\src\gsm610\add.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\add.c # Build CODE.C CODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ code.obj: $(CODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\code.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\code.c # Build DECODE.C DECODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ decode.obj: $(DECODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\decode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\decode.c # Build GSM_CREATE.C GSM_CREATE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_create.obj: $(GSM_CREATE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_create.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_create.c # Build GSM_DECODE.C GSM_DECODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_decode.obj: $(GSM_DECODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_decode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_decode.c # Build GSM_DESTROY.C GSM_DESTROY_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_destroy.obj: $(GSM_DESTROY_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_destroy.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_destroy.c # Build GSM_ENCODE.C GSM_ENCODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_encode.obj: $(GSM_ENCODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_encode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_encode.c # Build GSM_OPTION.C GSM_OPTION_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_option.obj: $(GSM_OPTION_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_option.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_option.c # Build LONG_TERM.C LONG_TERM_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ long_term.obj: $(LONG_TERM_C) $(SRCDIR)\common\libsndfile\src\gsm610\long_term.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\long_term.c # Build LPC.C LPC_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ lpc.obj: $(LPC_C) $(SRCDIR)\common\libsndfile\src\gsm610\lpc.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\lpc.c # Build PREPROCESS.C PREPROCESS_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ preprocess.obj: $(PREPROCESS_C) $(SRCDIR)\common\libsndfile\src\gsm610\preprocess.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\preprocess.c # Build RPE.C RPE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ rpe.obj: $(RPE_C) $(SRCDIR)\common\libsndfile\src\gsm610\rpe.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\rpe.c # Build SHORT_TERM.C SHORT_TERM_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ short_term.obj: $(SHORT_TERM_C) $(SRCDIR)\common\libsndfile\src\gsm610\short_term.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\short_term.c # Build TABLE.C TABLE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ table.obj: $(TABLE_C) $(SRCDIR)\common\libsndfile\src\gsm610\table.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\table.c # Build NEWPCM.C NEWPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ newpcm.obj: $(NEWPCM_C) $(SRCDIR)\common\libsndfile\src\newpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\newpcm.c # Build PAF.C PAF_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ paf.obj: $(PAF_C) $(SRCDIR)\common\libsndfile\src\paf.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\paf.c # Build PCM.C PCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ pcm.obj: $(PCM_C) $(SRCDIR)\common\libsndfile\src\pcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\pcm.c # Build RAW.C RAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ raw.obj: $(RAW_C) $(SRCDIR)\common\libsndfile\src\raw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\raw.c # Build SNDFILE.C SNDFILE_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ sndfile.obj: $(SNDFILE_C) $(SRCDIR)\common\libsndfile\src\sndfile.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\sndfile.c # Build SVX.C SVX_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ svx.obj: $(SVX_C) $(SRCDIR)\common\libsndfile\src\svx.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\svx.c # Build ULAW.C ULAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ ulaw.obj: $(ULAW_C) $(SRCDIR)\common\libsndfile\src\ulaw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\ulaw.c # Build WAV.C WAV_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ $(SRCDIR)\common\libsndfile\src\ulaw.h\ $(SRCDIR)\common\libsndfile\src\alaw.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav.obj: $(WAV_C) $(SRCDIR)\common\libsndfile\src\wav.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav.c # Build WAV_FLOAT.C WAV_FLOAT_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_float.obj: $(WAV_FLOAT_C) $(SRCDIR)\common\libsndfile\src\wav_float.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_float.c # Build WAV_GSM610.C WAV_GSM610_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ $(SRCDIR)\common\libsndfile\src\GSM610\gsm.h\ wav_gsm610.obj: $(WAV_GSM610_C) $(SRCDIR)\common\libsndfile\src\wav_gsm610.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_gsm610.c # Build WAV_IMA_ADPCM.C WAV_IMA_ADPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_ima_adpcm.obj: $(WAV_IMA_ADPCM_C) $(SRCDIR)\common\libsndfile\src\wav_ima_adpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_ima_adpcm.c # Build WAV_MS_ADPCM.C WAV_MS_ADPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_ms_adpcm.obj: $(WAV_MS_ADPCM_C) $(SRCDIR)\common\libsndfile\src\wav_ms_adpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_ms_adpcm.c # Build MAIN.C MAIN_C=\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\getopt\getopt.h\ $(SRCDIR)\include\faac.h\ main.obj: $(MAIN_C) $(SRCDIR)\frontend\main.c $(CC) -c $(CFLAGS) $(SRCDIR)\frontend\main.c # Build AACQUANT.C AACQUANT_C=\ $(SRCDIR)\libfaac\aacquant.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\util.h\ aacquant.obj: $(AACQUANT_C) $(SRCDIR)\libfaac\aacquant.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\aacquant.c # Build BACKPRED.C BACKPRED_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\backpred.h\ backpred.obj: $(BACKPRED_C) $(SRCDIR)\libfaac\backpred.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\backpred.c # Build BITSTREAM.C BITSTREAM_C=\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ bitstream.obj: $(BITSTREAM_C) $(SRCDIR)\libfaac\bitstream.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\bitstream.c # Build CHANNELS.C CHANNELS_C=\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ channels.obj: $(CHANNELS_C) $(SRCDIR)\libfaac\channels.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\channels.c # Build FFT.C FFT_C=\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ fft.obj: $(FFT_C) $(SRCDIR)\libfaac\fft.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\fft.c # Build FILTBANK.C FILTBANK_C=\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ filtbank.obj: $(FILTBANK_C) $(SRCDIR)\libfaac\filtbank.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\filtbank.c # Build FRAME.C FRAME_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\joint.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\aacquant.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\util.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\backpred.h\ frame.obj: $(FRAME_C) $(SRCDIR)\libfaac\frame.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\frame.c # Build HUFFMAN.C HUFFMAN_C=\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\util.h\ $(SRCDIR)\libfaac\hufftab.h\ huffman.obj: $(HUFFMAN_C) $(SRCDIR)\libfaac\huffman.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\huffman.c # Build JOINT.C JOINT_C=\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ joint.obj: $(JOINT_C) $(SRCDIR)\libfaac\joint.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\joint.c # Build LTP.C LTP_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\util.h\ ltp.obj: $(LTP_C) $(SRCDIR)\libfaac\ltp.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\ltp.c # Build PSYCH.C PSYCH_C=\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ psych.obj: $(PSYCH_C) $(SRCDIR)\libfaac\psych.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\psych.c # Build TNS.C TNS_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\util.h\ tns.obj: $(TNS_C) $(SRCDIR)\libfaac\tns.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\tns.c # Build UTIL.C UTIL_C=\ $(SRCDIR)\libfaac\util.h\ util.obj: $(UTIL_C) $(SRCDIR)\libfaac\util.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\util.c link: $(LINKER) -s -subsystem console -o $(SRCDIR)\lcc\faac.exe $(OBJS) $(LIBS) faac-1.28/project/mingw32/0000755010307701030770000000000011144236237017003 5ustar fabian-guestfabian-guestfaac-1.28/project/mingw32/Makefile0000644010307701030770000005370307372554451020464 0ustar fabian-guestfabian-guest# Makefile for project faac # Edit this path to let it point to the location of the source on your HDD SRCDIR=e:\faac # Edit this path to let it point to the location of your MinGW (or Dev-C++) installation CCDIR=c:\MinGW # No editing needed after this point CFLAGS=-mconsole -O3 -DWIN32 -I$(CCDIR)\include -I$(SRCDIR)\include -I$(SRCDIR)\common\getopt -I$(SRCDIR)\common\libsndfile\win32 -I$(SRCDIR)\common\libsndfile\src CC=$(CCDIR)\bin\gcc.exe LINKER=$(CCDIR)\bin\gcc.exe OBJS=\ getopt.o \ aiff.o \ alaw.o \ au.o \ au_g72x.o \ common.o \ g721.o \ g723_16.o \ g723_24.o \ g723_40.o \ g72x.o \ add.o \ code.o \ decode.o \ gsm_create.o \ gsm_decode.o \ gsm_destroy.o \ gsm_encode.o \ gsm_option.o \ long_term.o \ lpc.o \ preprocess.o \ rpe.o \ short_term.o \ table.o \ newpcm.o \ paf.o \ pcm.o \ raw.o \ sndfile.o \ svx.o \ ulaw.o \ wav.o \ wav_float.o \ wav_gsm610.o \ wav_ima_adpcm.o \ wav_ms_adpcm.o \ main.o \ aacquant.o \ backpred.o \ bitstream.o \ channels.o \ fft.o \ filtbank.o \ frame.o \ huffman.o \ joint.o \ ltp.o \ psych.o \ tns.o \ util.o LIBS= faac.exe: $(OBJS) Makefile $(LINKER) -s -o $(SRCDIR)\project\faac.exe $(OBJS) $(LIBS) # Build GETOPT.C GETOPT_C=\ $(SRCDIR)\common\getopt\getopt.h\ getopt.o: $(GETOPT_C) $(SRCDIR)\common\getopt\getopt.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\getopt\getopt.c # Build AIFF.C AIFF_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ aiff.o: $(AIFF_C) $(SRCDIR)\common\libsndfile\src\aiff.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\aiff.c # Build ALAW.C ALAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ alaw.o: $(ALAW_C) $(SRCDIR)\common\libsndfile\src\alaw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\alaw.c # Build AU.C AU_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ $(SRCDIR)\common\libsndfile\src\au.h\ $(SRCDIR)\common\libsndfile\src\ulaw.h\ $(SRCDIR)\common\libsndfile\src\alaw.h\ au.o: $(AU_C) $(SRCDIR)\common\libsndfile\src\au.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\au.c # Build AU_G72X.C AU_G72X_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\au.h\ $(SRCDIR)\common\libsndfile\src\G72x\g72x.h\ au_g72x.o: $(AU_G72X_C) $(SRCDIR)\common\libsndfile\src\au_g72x.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\au_g72x.c # Build COMMON.C COMMON_C=\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ common.o: $(COMMON_C) $(SRCDIR)\common\libsndfile\src\common.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\common.c # Build G721.C G721_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g721.o: $(G721_C) $(SRCDIR)\common\libsndfile\src\g72x\g721.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g721.c # Build G723_16.C G723_16_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_16.o: $(G723_16_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_16.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_16.c # Build G723_24.C G723_24_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_24.o: $(G723_24_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_24.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_24.c # Build G723_40.C G723_40_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g723_40.o: $(G723_40_C) $(SRCDIR)\common\libsndfile\src\g72x\g723_40.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g723_40.c # Build G72X.C G72X_C=\ $(SRCDIR)\common\libsndfile\src\g72x\g72x.h\ $(SRCDIR)\common\libsndfile\src\g72x\private.h\ g72x.o: $(G72X_C) $(SRCDIR)\common\libsndfile\src\g72x\g72x.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\g72x\g72x.c # Build ADD.C ADD_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ add.o: $(ADD_C) $(SRCDIR)\common\libsndfile\src\gsm610\add.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\add.c # Build CODE.C CODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ code.o: $(CODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\code.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\code.c # Build DECODE.C DECODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ decode.o: $(DECODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\decode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\decode.c # Build GSM_CREATE.C GSM_CREATE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_create.o: $(GSM_CREATE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_create.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_create.c # Build GSM_DECODE.C GSM_DECODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_decode.o: $(GSM_DECODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_decode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_decode.c # Build GSM_DESTROY.C GSM_DESTROY_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\config.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_destroy.o: $(GSM_DESTROY_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_destroy.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_destroy.c # Build GSM_ENCODE.C GSM_ENCODE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_encode.o: $(GSM_ENCODE_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_encode.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_encode.c # Build GSM_OPTION.C GSM_OPTION_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ gsm_option.o: $(GSM_OPTION_C) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_option.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\gsm_option.c # Build LONG_TERM.C LONG_TERM_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ long_term.o: $(LONG_TERM_C) $(SRCDIR)\common\libsndfile\src\gsm610\long_term.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\long_term.c # Build LPC.C LPC_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ lpc.o: $(LPC_C) $(SRCDIR)\common\libsndfile\src\gsm610\lpc.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\lpc.c # Build PREPROCESS.C PREPROCESS_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ preprocess.o: $(PREPROCESS_C) $(SRCDIR)\common\libsndfile\src\gsm610\preprocess.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\preprocess.c # Build RPE.C RPE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ rpe.o: $(RPE_C) $(SRCDIR)\common\libsndfile\src\gsm610\rpe.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\rpe.c # Build SHORT_TERM.C SHORT_TERM_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ short_term.o: $(SHORT_TERM_C) $(SRCDIR)\common\libsndfile\src\gsm610\short_term.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\short_term.c # Build TABLE.C TABLE_C=\ $(SRCDIR)\common\libsndfile\src\gsm610\private.h\ $(SRCDIR)\common\libsndfile\src\gsm610\proto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\unproto.h\ $(SRCDIR)\common\libsndfile\src\gsm610\gsm.h\ table.o: $(TABLE_C) $(SRCDIR)\common\libsndfile\src\gsm610\table.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\gsm610\table.c # Build NEWPCM.C NEWPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ newpcm.o: $(NEWPCM_C) $(SRCDIR)\common\libsndfile\src\newpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\newpcm.c # Build PAF.C PAF_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ paf.o: $(PAF_C) $(SRCDIR)\common\libsndfile\src\paf.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\paf.c # Build PCM.C PCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ pcm.o: $(PCM_C) $(SRCDIR)\common\libsndfile\src\pcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\pcm.c # Build RAW.C RAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ raw.o: $(RAW_C) $(SRCDIR)\common\libsndfile\src\raw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\raw.c # Build SNDFILE.C SNDFILE_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ sndfile.o: $(SNDFILE_C) $(SRCDIR)\common\libsndfile\src\sndfile.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\sndfile.c # Build SVX.C SVX_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ svx.o: $(SVX_C) $(SRCDIR)\common\libsndfile\src\svx.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\svx.c # Build ULAW.C ULAW_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\src\common.h\ ulaw.o: $(ULAW_C) $(SRCDIR)\common\libsndfile\src\ulaw.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\ulaw.c # Build WAV.C WAV_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\pcm.h\ $(SRCDIR)\common\libsndfile\src\ulaw.h\ $(SRCDIR)\common\libsndfile\src\alaw.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav.o: $(WAV_C) $(SRCDIR)\common\libsndfile\src\wav.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav.c # Build WAV_FLOAT.C WAV_FLOAT_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_float.o: $(WAV_FLOAT_C) $(SRCDIR)\common\libsndfile\src\wav_float.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_float.c # Build WAV_GSM610.C WAV_GSM610_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ $(SRCDIR)\common\libsndfile\src\GSM610\gsm.h\ wav_gsm610.o: $(WAV_GSM610_C) $(SRCDIR)\common\libsndfile\src\wav_gsm610.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_gsm610.c # Build WAV_IMA_ADPCM.C WAV_IMA_ADPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_ima_adpcm.o: $(WAV_IMA_ADPCM_C) $(SRCDIR)\common\libsndfile\src\wav_ima_adpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_ima_adpcm.c # Build WAV_MS_ADPCM.C WAV_MS_ADPCM_C=\ $(SRCDIR)\common\libsndfile\win32\unistd.h\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\sfendian.h\ $(SRCDIR)\common\libsndfile\win32\config.h\ $(SRCDIR)\common\libsndfile\src\common.h\ $(SRCDIR)\common\libsndfile\src\wav.h\ wav_ms_adpcm.o: $(WAV_MS_ADPCM_C) $(SRCDIR)\common\libsndfile\src\wav_ms_adpcm.c $(CC) -c $(CFLAGS) $(SRCDIR)\common\libsndfile\src\wav_ms_adpcm.c # Build MAIN.C MAIN_C=\ $(SRCDIR)\common\libsndfile\src\sndfile.h\ $(SRCDIR)\common\getopt\getopt.h\ $(SRCDIR)\include\faac.h\ main.o: $(MAIN_C) $(SRCDIR)\frontend\main.c $(CC) -c $(CFLAGS) $(SRCDIR)\frontend\main.c # Build AACQUANT.C AACQUANT_C=\ $(SRCDIR)\libfaac\aacquant.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\util.h\ aacquant.o: $(AACQUANT_C) $(SRCDIR)\libfaac\aacquant.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\aacquant.c # Build BACKPRED.C BACKPRED_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\backpred.h\ backpred.o: $(BACKPRED_C) $(SRCDIR)\libfaac\backpred.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\backpred.c # Build BITSTREAM.C BITSTREAM_C=\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ bitstream.o: $(BITSTREAM_C) $(SRCDIR)\libfaac\bitstream.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\bitstream.c # Build CHANNELS.C CHANNELS_C=\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ channels.o: $(CHANNELS_C) $(SRCDIR)\libfaac\channels.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\channels.c # Build FFT.C FFT_C=\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ fft.o: $(FFT_C) $(SRCDIR)\libfaac\fft.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\fft.c # Build FILTBANK.C FILTBANK_C=\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ filtbank.o: $(FILTBANK_C) $(SRCDIR)\libfaac\filtbank.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\filtbank.c # Build FRAME.C FRAME_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\joint.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\aacquant.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\util.h\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\backpred.h\ frame.o: $(FRAME_C) $(SRCDIR)\libfaac\frame.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\frame.c # Build HUFFMAN.C HUFFMAN_C=\ $(SRCDIR)\libfaac\huffman.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\util.h\ $(SRCDIR)\libfaac\hufftab.h\ huffman.o: $(HUFFMAN_C) $(SRCDIR)\libfaac\huffman.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\huffman.c # Build JOINT.C JOINT_C=\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\util.h\ joint.o: $(JOINT_C) $(SRCDIR)\libfaac\joint.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\joint.c # Build LTP.C LTP_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\ltp.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\filtbank.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\util.h\ ltp.o: $(LTP_C) $(SRCDIR)\libfaac\ltp.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\ltp.c # Build PSYCH.C PSYCH_C=\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\fft.h\ $(SRCDIR)\libfaac\util.h\ psych.o: $(PSYCH_C) $(SRCDIR)\libfaac\psych.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\psych.c # Build TNS.C TNS_C=\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\psych.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\bitstream.h\ $(SRCDIR)\libfaac\frame.h\ $(SRCDIR)\libfaac\coder.h\ $(SRCDIR)\libfaac\channels.h\ $(SRCDIR)\libfaac\tns.h\ $(SRCDIR)\libfaac\util.h\ tns.o: $(TNS_C) $(SRCDIR)\libfaac\tns.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\tns.c # Build UTIL.C UTIL_C=\ $(SRCDIR)\libfaac\util.h\ util.o: $(UTIL_C) $(SRCDIR)\libfaac\util.c $(CC) -c $(CFLAGS) $(SRCDIR)\libfaac\util.c link: $(LINKER) -s -o $(SRCDIR)\project\faac.exe $(OBJS) $(LIBS) faac-1.28/project/mingw32/faac.dev0000644010307701030770000000617407372554451020416 0ustar fabian-guestfabian-guest[Project] FileName=E:\faac\project\mingw32\faac.dev Name=faac Use_gpp=0 UnitCount=51 ResFiles= NoConsole=0 IsDll=0 Icon=C:\DEV-C++\Icon\Console.ico CompilerOptions=-DWIN32 IncludeDirs=e:\faac\common\getopt\;e:\faac\common\libsndfile\src\;e:\faac\common\libsndfile\win32\;e:\faac\include\;e:\faac\libfaac\ ObjFile= [Unit1] FileName=E:\faac\common\getopt\getopt.c [Unit2] FileName=E:\faac\common\libsndfile\src\aiff.c [Unit3] FileName=E:\faac\common\libsndfile\src\alaw.c [Unit4] FileName=E:\faac\common\libsndfile\src\au.c [Unit5] FileName=E:\faac\common\libsndfile\src\au_g72x.c [Unit6] FileName=E:\faac\common\libsndfile\src\common.c [Unit7] FileName=E:\faac\common\libsndfile\src\G72x\g721.c [Unit8] FileName=E:\faac\common\libsndfile\src\G72x\g723_16.c [Unit9] FileName=E:\faac\common\libsndfile\src\G72x\g723_24.c [Unit10] FileName=E:\faac\common\libsndfile\src\G72x\g723_40.c [Unit11] FileName=E:\faac\common\libsndfile\src\G72x\g72x.c [Unit12] FileName=E:\faac\common\libsndfile\src\GSM610\add.c [Unit13] FileName=E:\faac\common\libsndfile\src\GSM610\table.c [Unit14] FileName=E:\faac\common\libsndfile\src\GSM610\decode.c [Unit15] FileName=E:\faac\common\libsndfile\src\GSM610\gsm_create.c [Unit16] FileName=E:\faac\common\libsndfile\src\GSM610\gsm_decode.c [Unit17] FileName=E:\faac\common\libsndfile\src\GSM610\gsm_destroy.c [Unit18] FileName=E:\faac\common\libsndfile\src\GSM610\gsm_encode.c [Unit19] FileName=E:\faac\common\libsndfile\src\GSM610\gsm_option.c [Unit20] FileName=E:\faac\common\libsndfile\src\GSM610\long_term.c [Unit21] FileName=E:\faac\common\libsndfile\src\GSM610\lpc.c [Unit22] FileName=E:\faac\common\libsndfile\src\GSM610\preprocess.c [Unit23] FileName=E:\faac\common\libsndfile\src\GSM610\rpe.c [Unit24] FileName=E:\faac\common\libsndfile\src\GSM610\short_term.c [Unit25] FileName=E:\faac\common\libsndfile\src\GSM610\code.c [Unit26] FileName=E:\faac\common\libsndfile\src\wav_ms_adpcm.c [Unit27] FileName=E:\faac\common\libsndfile\src\paf.c [Unit28] FileName=E:\faac\common\libsndfile\src\pcm.c [Unit29] FileName=E:\faac\common\libsndfile\src\raw.c [Unit30] FileName=E:\faac\common\libsndfile\src\sndfile.c [Unit31] FileName=E:\faac\common\libsndfile\src\svx.c [Unit32] FileName=E:\faac\common\libsndfile\src\ulaw.c [Unit33] FileName=E:\faac\common\libsndfile\src\wav.c [Unit34] FileName=E:\faac\common\libsndfile\src\wav_float.c [Unit35] FileName=E:\faac\common\libsndfile\src\wav_gsm610.c [Unit36] FileName=E:\faac\common\libsndfile\src\wav_ima_adpcm.c [Unit37] FileName=E:\faac\common\libsndfile\src\newpcm.c [Unit38] FileName=E:\faac\frontend\main.c [Unit39] FileName=E:\faac\libfaac\util.c [Unit40] FileName=E:\faac\libfaac\backpred.c [Unit41] FileName=E:\faac\libfaac\bitstream.c [Unit42] FileName=E:\faac\libfaac\channels.c [Unit43] FileName=E:\faac\libfaac\fft.c [Unit44] FileName=E:\faac\libfaac\filtbank.c [Unit45] FileName=E:\faac\libfaac\frame.c [Unit46] FileName=E:\faac\libfaac\huffman.c [Unit47] FileName=E:\faac\libfaac\joint.c [Unit48] FileName=E:\faac\libfaac\ltp.c [Unit49] FileName=E:\faac\libfaac\psych.c [Unit50] FileName=E:\faac\libfaac\tns.c [Unit51] FileName=E:\faac\libfaac\aacquant.c faac-1.28/aclocal.m40000644010307701030770000077552111144236250015723 0ustar fabian-guestfabian-guest# 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 Debian 1.5.22-4 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 </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 < #endif #include #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.so # instead of lib.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 ;; 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* | k*bsd*-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' 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' ;; netbsdelf*-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='NetBSD ld.elf_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 <&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 &1 /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* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) 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 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* | 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* | k*bsd*-gnu) 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* | netbsdelf*-gnu) 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 < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$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 , 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* | k*bsd*-gnu) 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 < $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 < 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 <> 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* | 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* | k*bsd*-gnu) 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* | netbsdelf*-gnu) ;; 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* | k*bsd*-gnu) 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' ;; linux* | k*bsd*-gnu) _LT_AC_TAGVAR(link_all_deplibs, $1)=no ;; *) _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 <&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 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 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* | k*bsd*-gnu) 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 _LT_AC_TAGVAR(link_all_deplibs, $1)=no else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) 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 <&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* | 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* | netbsdelf*-gnu) 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 # #undef WIN32_LEAN_AND_MEAN # #include # # #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 # 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 /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 faac-1.28/config.guess0000755010307701030770000012626011144236255016376 0ustar fabian-guestfabian-guest#! /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-07-02' # 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 . # Please send patches to . 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 ." 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 # 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 powerpc-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 /* 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 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 #include 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 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*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]*) 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}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-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}-unknown-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}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-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}-unknown-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-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-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}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-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 #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}-pc-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' /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 echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # 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 < # include #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 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 # 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 < 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: faac-1.28/config.sub0000755010307701030770000007730011144236255016041 0ustar fabian-guestfabian-guest#! /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-07-02' # 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 . 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 ." 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 | avr32 \ | 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-* | avr32-* \ | 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* | -toppers*) # 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: faac-1.28/ltmain.sh0000644010307701030770000060015710410112437015666 0ustar fabian-guestfabian-guest# 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 , 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 Debian 1.5.22-4" 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 <&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 </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 <> ${libobj}T </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 <> ${libobj}T <&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%" test "X$link_all_deplibs" != Xno && libs="$libs $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" ;; *) $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 ;; 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 </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 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 <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #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 <> $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> $cwrappersource <> $cwrappersource <> $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 ." 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: faac-1.28/config.h.in0000644010307701030770000000657311144236253016103 0ustar fabian-guestfabian-guest/* config.h.in. Generated from configure.in by autoheader. */ /* Define if you want to encode for DRM */ #undef DRM /* Define to 1 if you have the declaration of `MP4Create', and to 0 if you don't. */ #undef HAVE_DECL_MP4CREATE /* Define to 1 if you have the declaration of `MP4MetadataDelete', and to 0 if you don't. */ #undef HAVE_DECL_MP4METADATADELETE /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if `__pos' is member of `fpos_t'. */ #undef HAVE_FPOS_T___POS /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if the system has the type `int16_t'. */ #undef HAVE_INT16_T /* Define to 1 if the system has the type `int32_t'. */ #undef HAVE_INT32_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if the system has the type `in_port_t'. */ #undef HAVE_IN_PORT_T /* Define to 1 if you have the `gnugetopt' library (-lgnugetopt). */ #undef HAVE_LIBGNUGETOPT /* define if needed */ #undef HAVE_LIBMP4V2 /* Define to 1 if you have the header file. */ #undef HAVE_MATHF_H /* define if needed */ #undef HAVE_MEMCPY /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* define if needed */ #undef HAVE_STRCASECMP /* define if needed */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* define if needed */ #undef HAVE_STRSEP /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `u_int16_t'. */ #undef HAVE_U_INT16_T /* Define to 1 if the system has the type `u_int32_t'. */ #undef HAVE_U_INT32_T /* 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 /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* 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 `long int' if does not define. */ #undef off_t faac-1.28/configure0000755010307701030770000266740211144236252015774 0ustar fabian-guestfabian-guest#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for FAAC 1.28. # # Report bugs to . # # 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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 # 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 /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 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 : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF 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 : (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 if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 </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 &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='FAAC' PACKAGE_TARNAME='faac' PACKAGE_VERSION='1.28' PACKAGE_STRING='FAAC 1.28' PACKAGE_BUGREPORT='faac-dev@lists.sourceforge.net' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #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 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 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 CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os GREP EGREP LN_S ECHO AR RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL WITH_MP4V2_TRUE WITH_MP4V2_FALSE USE_DRM_TRUE USE_DRM_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP 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_TARNAME}' 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 FAAC 1.28 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/faac] --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 case $ac_init_help in short | recursive ) echo "Configuration of FAAC 1.28:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-drm Digital Radio Mondiale support --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --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-mp4v2 compile libmp4v2 --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] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor 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. Report bugs to . _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 FAAC configure 1.28 generated by GNU Autoconf 2.61 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 FAAC $as_me 1.28, which was generated by GNU Autoconf 2.61. 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 ac_aux_dir= for ac_dir in . "$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\"/." >&5 echo "$as_me: error: cannot find install-sh or install.sh in . \"$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. 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_test_x "$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_test_x "$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='faac' VERSION='1.28' 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_test_x "$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_test_x "$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 -' ac_config_headers="$ac_config_headers config.h" # Check whether --with-mp4v2 was given. if test "${with_mp4v2+set}" = set; then withval=$with_mp4v2; WITHMP4V2=$withval else WITHMP4V2=yes fi # Check whether --enable-drm was given. if test "${enable_drm+set}" = set; then enableval=$enable_drm; enable_drm=$enableval else enable_drm=no fi CFLAGS=${CFLAGS:-"-O2 -Wall"} 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_test_x "$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_test_x "$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_test_x "$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_test_x "$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_test_x "$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_test_x "$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 ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 #include #include #include /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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=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_test_x "$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_test_x "$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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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=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="$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 # 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-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=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 # 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 { 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_test_x "$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_test_x "$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 &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 &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 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 { 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* | 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* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) 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 4786 "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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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" 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 to if __STDC__ is defined, since # 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 #else # include #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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 _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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 to if __STDC__ is defined, since # 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 #else # include #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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 _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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 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 #include #include #include 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 _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 _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 #include #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 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 to if __STDC__ is defined, since # 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 #else # include #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 && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 _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 && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 to if __STDC__ is defined, since # 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 #else # include #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 && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 _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 && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort 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_test_x "$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 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort 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_test_x "$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); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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* | k*bsd*-gnu) 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 <&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 < 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 <> 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_test_x "$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_test_x "$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_test_x "$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_test_x "$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_test_x "$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_test_x "$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 <&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 <&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=no 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:7045: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:7049: \$? = $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* | k*bsd*-gnu) 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:7313: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:7317: \$? = $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:7417: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:7421: \$? = $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 <&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 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 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* | k*bsd*-gnu) 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 link_all_deplibs=no else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) 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 <&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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* | 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* | netbsdelf*-gnu) 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.so # instead of lib.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 ;; 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* | k*bsd*-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' 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' ;; netbsdelf*-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='NetBSD ld.elf_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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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 declares shl_load. For example, HP-UX 11i 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 to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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 declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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 < #endif #include #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 < #endif #include #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 , 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 &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 &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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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 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* | 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* | k*bsd*-gnu) 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* | netbsdelf*-gnu) 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 <&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* | 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* | k*bsd*-gnu) 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* | netbsdelf*-gnu) ;; 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:12150: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:12154: \$? = $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:12254: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:12258: \$? = $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' ;; linux* | k*bsd*-gnu) link_all_deplibs_CXX=no ;; *) 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.so # instead of lib.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 ;; 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* | k*bsd*-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' 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' ;; netbsdelf*-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='NetBSD ld.elf_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* | k*bsd*-gnu) 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:13815: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13819: \$? = $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:13919: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13923: \$? = $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 <&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 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 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* | k*bsd*-gnu) 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 link_all_deplibs_F77=no else ld_shlibs_F77=no fi ;; netbsd* | netbsdelf*-gnu) 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 <&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); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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* | 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* | netbsdelf*-gnu) 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.so # instead of lib.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 ;; 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* | k*bsd*-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' 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' ;; netbsdelf*-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='NetBSD ld.elf_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:16106: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16110: \$? = $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* | k*bsd*-gnu) 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:16374: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16378: \$? = $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:16478: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16482: \$? = $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 <&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 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 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* | k*bsd*-gnu) 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 link_all_deplibs_GCJ=no else ld_shlibs_GCJ=no fi ;; netbsd* | netbsdelf*-gnu) 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 <&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \ 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* | 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* | netbsdelf*-gnu) 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.so # instead of lib.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 ;; 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* | k*bsd*-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' 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' ;; netbsdelf*-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='NetBSD ld.elf_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 for ac_header in getopt.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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 u_int32_t" >&5 echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6; } if test "${ac_cv_type_u_int32_t+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 typedef u_int32_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_u_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int32_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6; } if test $ac_cv_type_u_int32_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_U_INT32_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking for u_int16_t" >&5 echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6; } if test "${ac_cv_type_u_int16_t+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 typedef u_int16_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_u_int16_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int16_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6; } if test $ac_cv_type_u_int16_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_U_INT16_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking for int32_t" >&5 echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } if test "${ac_cv_type_int32_t+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 typedef int32_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int32_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_int32_t" >&6; } if test $ac_cv_type_int32_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_INT32_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking for int16_t" >&5 echo $ECHO_N "checking for int16_t... $ECHO_C" >&6; } if test "${ac_cv_type_int16_t+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 typedef int16_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int16_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int16_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 echo "${ECHO_T}$ac_cv_type_int16_t" >&6; } if test $ac_cv_type_int16_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_INT16_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether strcasecmp is declared" >&5 echo $ECHO_N "checking whether strcasecmp is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_strcasecmp+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 int main () { #ifndef strcasecmp (void) strcasecmp; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strcasecmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strcasecmp=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_strcasecmp" >&5 echo "${ECHO_T}$ac_cv_have_decl_strcasecmp" >&6; } if test $ac_cv_have_decl_strcasecmp = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRCASECMP 1 _ACEOF fi { echo "$as_me:$LINENO: checking for getopt_long in -lgnugetopt" >&5 echo $ECHO_N "checking for getopt_long in -lgnugetopt... $ECHO_C" >&6; } if test "${ac_cv_lib_gnugetopt_getopt_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnugetopt $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 getopt_long (); int main () { return getopt_long (); ; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_gnugetopt_getopt_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gnugetopt_getopt_long=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_gnugetopt_getopt_long" >&5 echo "${ECHO_T}$ac_cv_lib_gnugetopt_getopt_long" >&6; } if test $ac_cv_lib_gnugetopt_getopt_long = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBGNUGETOPT 1 _ACEOF LIBS="-lgnugetopt $LIBS" fi if false; then WITH_MP4V2_TRUE= WITH_MP4V2_FALSE='#' else WITH_MP4V2_TRUE='#' WITH_MP4V2_FALSE= fi { echo "$as_me:$LINENO: checking whether MP4Create is declared" >&5 echo $ECHO_N "checking whether MP4Create is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_MP4Create+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 int main () { #ifndef MP4Create (void) MP4Create; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_MP4Create=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_MP4Create=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_MP4Create" >&5 echo "${ECHO_T}$ac_cv_have_decl_MP4Create" >&6; } if test $ac_cv_have_decl_MP4Create = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MP4CREATE 1 _ACEOF { echo "$as_me:$LINENO: checking for MP4MetadataDelete in -lmp4v2" >&5 echo $ECHO_N "checking for MP4MetadataDelete in -lmp4v2... $ECHO_C" >&6; } if test "${ac_cv_lib_mp4v2_MP4MetadataDelete+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmp4v2 -lstdc++ $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 MP4MetadataDelete (); int main () { return MP4MetadataDelete (); ; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_mp4v2_MP4MetadataDelete=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mp4v2_MP4MetadataDelete=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_mp4v2_MP4MetadataDelete" >&5 echo "${ECHO_T}$ac_cv_lib_mp4v2_MP4MetadataDelete" >&6; } if test $ac_cv_lib_mp4v2_MP4MetadataDelete = yes; then external_mp4v2=yes else external_mp4v2=no fi else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MP4CREATE 0 _ACEOF external_mp4v2=no fi { echo "$as_me:$LINENO: checking whether MP4MetadataDelete is declared" >&5 echo $ECHO_N "checking whether MP4MetadataDelete is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_MP4MetadataDelete+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 int main () { #ifndef MP4MetadataDelete (void) MP4MetadataDelete; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_MP4MetadataDelete=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_MP4MetadataDelete=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_MP4MetadataDelete" >&5 echo "${ECHO_T}$ac_cv_have_decl_MP4MetadataDelete" >&6; } if test $ac_cv_have_decl_MP4MetadataDelete = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MP4METADATADELETE 1 _ACEOF { echo "$as_me:$LINENO: checking for MP4MetadataDelete in -lmp4v2" >&5 echo $ECHO_N "checking for MP4MetadataDelete in -lmp4v2... $ECHO_C" >&6; } if test "${ac_cv_lib_mp4v2_MP4MetadataDelete+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmp4v2 -lstdc++ $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 MP4MetadataDelete (); int main () { return MP4MetadataDelete (); ; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_mp4v2_MP4MetadataDelete=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mp4v2_MP4MetadataDelete=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_mp4v2_MP4MetadataDelete" >&5 echo "${ECHO_T}$ac_cv_lib_mp4v2_MP4MetadataDelete" >&6; } if test $ac_cv_lib_mp4v2_MP4MetadataDelete = yes; then external_mp4v2=yes else external_mp4v2=no fi else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MP4METADATADELETE 0 _ACEOF external_mp4v2=no fi if test x$external_mp4v2 = xyes; then { echo "$as_me:$LINENO: *** Building with external mp4v2 ***" >&5 echo "$as_me: *** Building with external mp4v2 ***" >&6;} else if test x$WITHMP4V2 = xyes; then { echo "$as_me:$LINENO: *** Building with internal mp4v2 ***" >&5 echo "$as_me: *** Building with internal mp4v2 ***" >&6;} if true; then WITH_MP4V2_TRUE= WITH_MP4V2_FALSE='#' else WITH_MP4V2_TRUE='#' WITH_MP4V2_FALSE= fi ac_config_links="$ac_config_links common/mp4v2/mpeg4ip_config.h:config.h" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBMP4V2 1 _ACEOF else { echo "$as_me:$LINENO: *** Building WITHOUT mp4v2 ***" >&5 echo "$as_me: *** Building WITHOUT mp4v2 ***" >&6;} fi fi if test "x$enable_drm" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define DRM 1 _ACEOF if true; then USE_DRM_TRUE= USE_DRM_FALSE='#' else USE_DRM_TRUE='#' USE_DRM_FALSE= fi CFLAGS="$CFLAGS -DDRM" else if false; then USE_DRM_TRUE= USE_DRM_FALSE='#' else USE_DRM_TRUE='#' USE_DRM_FALSE= fi fi { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi 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_ext 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 int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; 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 ac_cv_c_bigendian=no 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_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { 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 #include #include #include 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 _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 _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 #include #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 # 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 /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=no; 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 /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 ac_cv_sys_file_offset_bits=unknown 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; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -f conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { 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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=no; 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 /* 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 ac_cv_sys_large_files=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -f conftest* fi fi for ac_header in stdint.h inttypes.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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 for ac_header in mathf.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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 for ac_header in float.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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 whether strchr is declared" >&5 echo $ECHO_N "checking whether strchr is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_strchr+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 int main () { #ifndef strchr (void) strchr; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strchr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strchr=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_strchr" >&5 echo "${ECHO_T}$ac_cv_have_decl_strchr" >&6; } if test $ac_cv_have_decl_strchr = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRCHR 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether memcpy is declared" >&5 echo $ECHO_N "checking whether memcpy is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_memcpy+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 int main () { #ifndef memcpy (void) memcpy; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_memcpy=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_memcpy=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_memcpy" >&5 echo "${ECHO_T}$ac_cv_have_decl_memcpy" >&6; } if test $ac_cv_have_decl_memcpy = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MEMCPY 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether strsep is declared" >&5 echo $ECHO_N "checking whether strsep is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_strsep+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 int main () { #ifndef strsep (void) strsep; #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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strsep=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strsep=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_have_decl_strsep" >&5 echo "${ECHO_T}$ac_cv_have_decl_strsep" >&6; } if test $ac_cv_have_decl_strsep = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRSEP 1 _ACEOF fi for ac_header in sys/time.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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ( cat <<\_ASBOX ## --------------------------------------------- ## ## Report this to faac-dev@lists.sourceforge.net ## ## --------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&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 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 #include #include 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 { echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+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 typedef off_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi { echo "$as_me:$LINENO: checking for in_port_t" >&5 echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6; } if test "${ac_cv_type_in_port_t+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 #include #include typedef in_port_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_in_port_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_in_port_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_in_port_t" >&5 echo "${ECHO_T}$ac_cv_type_in_port_t" >&6; } if test $ac_cv_type_in_port_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_IN_PORT_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } if test "${ac_cv_type_socklen_t+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 #include #include typedef socklen_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_socklen_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_socklen_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } if test $ac_cv_type_socklen_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_SOCKLEN_T 1 _ACEOF fi { echo "$as_me:$LINENO: checking for fpos_t.__pos" >&5 echo $ECHO_N "checking for fpos_t.__pos... $ECHO_C" >&6; } if test "${ac_cv_member_fpos_t___pos+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 int main () { static fpos_t ac_aggr; if (ac_aggr.__pos) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_fpos_t___pos=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static fpos_t ac_aggr; if (sizeof ac_aggr.__pos) 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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_fpos_t___pos=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_fpos_t___pos=no 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 { echo "$as_me:$LINENO: result: $ac_cv_member_fpos_t___pos" >&5 echo "${ECHO_T}$ac_cv_member_fpos_t___pos" >&6; } if test $ac_cv_member_fpos_t___pos = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_FPOS_T___POS 1 _ACEOF fi ac_config_files="$ac_config_files common/Makefile common/mp4v2/Makefile libfaac/Makefile frontend/Makefile include/Makefile 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__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 "${WITH_MP4V2_TRUE}" && test -z "${WITH_MP4V2_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"WITH_MP4V2\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"WITH_MP4V2\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WITH_MP4V2_TRUE}" && test -z "${WITH_MP4V2_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"WITH_MP4V2\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"WITH_MP4V2\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_DRM_TRUE}" && test -z "${USE_DRM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_DRM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_DRM\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_DRM_TRUE}" && test -z "${USE_DRM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_DRM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_DRM\" 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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 # 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 if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 FAAC $as_me 1.28, which was generated by GNU Autoconf 2.61. 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_links="$ac_config_links" 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 and configuration settings, 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 links: $config_links Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ FAAC config.status 1.28 configured by $0, generated by GNU Autoconf 2.61, 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 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "common/mp4v2/mpeg4ip_config.h") CONFIG_LINKS="$CONFIG_LINKS common/mp4v2/mpeg4ip_config.h:config.h" ;; "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; "common/mp4v2/Makefile") CONFIG_FILES="$CONFIG_FILES common/mp4v2/Makefile" ;; "libfaac/Makefile") CONFIG_FILES="$CONFIG_FILES libfaac/Makefile" ;; "frontend/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES 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_LINKS+set}" = set || CONFIG_LINKS=$config_links 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 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 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 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 GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim AR!$AR$ac_delim RANLIB!$RANLIB$ac_delim CPP!$CPP$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$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 >$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 FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim WITH_MP4V2_TRUE!$WITH_MP4V2_TRUE$ac_delim WITH_MP4V2_FALSE!$WITH_MP4V2_FALSE$ac_delim USE_DRM_TRUE!$USE_DRM_TRUE$ac_delim USE_DRM_FALSE!$USE_DRM_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` = 9; 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 >$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 :L $CONFIG_LINKS :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 ;; :L) # # CONFIG_LINK # { echo "$as_me:$LINENO: linking $srcdir/$ac_source to $ac_file" >&5 echo "$as_me: linking $srcdir/$ac_source to $ac_file" >&6;} if test ! -r "$srcdir/$ac_source"; then { { echo "$as_me:$LINENO: error: $srcdir/$ac_source: file not found" >&5 echo "$as_me: error: $srcdir/$ac_source: file not found" >&2;} { (exit 1); exit 1; }; } fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. case $srcdir in [\\/$]* | ?:[\\/]* ) ac_rel_source=$srcdir/$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null || cp -p "$srcdir/$ac_source" "$ac_file" || { { echo "$as_me:$LINENO: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&5 echo "$as_me: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :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 faac-1.28/install-sh0000755010307701030770000002202111144236254016047 0ustar fabian-guestfabian-guest#!/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: faac-1.28/missing0000755010307701030770000002540611144236254015454 0ustar fabian-guestfabian-guest#! /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 , 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 ." 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: faac-1.28/depcomp0000755010307701030770000003710011144236255015425 0ustar fabian-guestfabian-guest#! /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 . 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 . 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: faac-1.28/Makefile.in0000644010307701030770000004526111144236255016124 0ustar fabian-guestfabian-guest# 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 $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO config.guess config.sub depcomp install-sh ltmain.sh \ missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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 = 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) 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@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ 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@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_DRM_FALSE = @USE_DRM_FALSE@ USE_DRM_TRUE = @USE_DRM_TRUE@ VERSION = @VERSION@ WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ WITH_MP4V2_TRUE = @WITH_MP4V2_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 = include libfaac common frontend all: config.h $(MAKE) $(AM_MAKEFLAGS) 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) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu 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) 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 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: # 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. @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 -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 config.h 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-hdr \ 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-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr 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 # 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: